Move OPTNONE macro to eficompiler.h

This is also useful in downstream projects so add it
to public header

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
Callum Farmer 2023-06-21 22:19:54 +01:00 committed by Nigel Croxon
parent eab878741a
commit 7f8e2d44ed
2 changed files with 11 additions and 7 deletions

View File

@ -37,13 +37,7 @@ GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner)
EFI_GUID DUMMY_GUID = EFI_GUID DUMMY_GUID =
{0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}}; {0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
#if defined(__clang__) static EFI_OPTNONE void
# define _OPTNONE __attribute__((optnone))
#else
# define _OPTNONE __attribute__((__optimize__("0")))
#endif
static _OPTNONE void
DebugHook(void) DebugHook(void)
{ {
EFI_GUID guid = DUMMY_GUID; EFI_GUID guid = DUMMY_GUID;

View File

@ -28,6 +28,16 @@ Abstract:
#endif #endif
#endif #endif
#ifdef _MSC_EXTENSIONS
#define EFI_OPTNONE
#else
#ifdef __clang__
#define EFI_OPTNONE __attribute__((optnone))
#else
#define EFI_OPTNONE __attribute__((__optimize__("0")))
#endif
#endif
#ifdef _MSC_EXTENSIONS #ifdef _MSC_EXTENSIONS
#define ALIGN(x) __declspec(align(x)) #define ALIGN(x) __declspec(align(x))
#else #else