Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b216d7b

Browse files
franksinankayaSinan Kaya
authored and
Sinan Kaya
committed
Abstract optnone compiler attribute
GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes]
1 parent bc0f6f3 commit b216d7b

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/pal/inc/pal.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ typedef void * NATIVE_LIBRARY_HANDLE;
176176
#endif
177177
#endif
178178

179+
#ifndef NOOPT_ATTRIBUTE
180+
#if defined(_MSC_VER) || defined(__llvm__)
181+
#define NOOPT_ATTRIBUTE optnone
182+
#else
183+
#define NOOPT_ATTRIBUTE optimize("O0")
184+
#endif
185+
#endif
186+
179187
#ifndef PAL_STDCPP_COMPAT
180188

181189
#if __GNUC__

src/pal/src/exception/seh-unwind.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ PAL_FreeExceptionRecords(IN EXCEPTION_RECORD *exceptionRecord, IN CONTEXT *conte
444444
--*/
445445
PAL_NORETURN
446446
__attribute__((noinline))
447-
__attribute__((optnone))
447+
__attribute__((NOOPT_ATTRIBUTE))
448448
static void
449449
RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord, CONTEXT *ContextRecord)
450450
{

src/pal/src/init/pal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ PAL_SetInitializeDLLFlags(
239239
real life scenarios work.
240240
241241
--*/
242-
__attribute__((noinline,optnone))
242+
__attribute__((noinline,NOOPT_ATTRIBUTE))
243243
void
244244
EnsureStackSize(SIZE_T stackSize)
245245
{

src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int InitializeDllTest1()
2121
return PAL_InitializeDLL();
2222
}
2323

24-
__attribute__((noinline,optnone))
24+
__attribute__((noinline,NOOPT_ATTRIBUTE))
2525
static void FailingFunction(volatile int *p)
2626
{
2727
if (p == NULL)

src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int InitializeDllTest2()
2121
return PAL_InitializeDLL();
2222
}
2323

24-
__attribute__((noinline,optnone))
24+
__attribute__((noinline,NOOPT_ATTRIBUTE))
2525
static void FailingFunction(volatile int *p)
2626
{
2727
if (p == NULL)

0 commit comments

Comments
 (0)