2016-03-25 20:32:54 +03:00
|
|
|
/*++
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
Copyright (c) 2016-2024 Pete Batard <pete@akeo.ie>
|
2016-03-25 20:32:54 +03:00
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
|
|
|
eficompiler.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
Compiler specific adjustments
|
|
|
|
|
|
|
|
--*/
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(__GNUC__)
|
2016-03-25 20:32:54 +03:00
|
|
|
#define EFI_UNUSED __attribute__((__unused__))
|
2024-05-14 14:52:26 +03:00
|
|
|
#else
|
|
|
|
#define EFI_UNUSED
|
2016-03-25 20:32:54 +03:00
|
|
|
#endif
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(__clang__)
|
2024-03-22 17:23:15 +03:00
|
|
|
#define EFI_NO_TAIL_CALL __attribute__((disable_tail_calls))
|
2024-05-14 14:52:26 +03:00
|
|
|
#elif defined(__GNUC__)
|
2024-03-22 17:23:15 +03:00
|
|
|
#define EFI_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls")))
|
2024-05-14 14:52:26 +03:00
|
|
|
#else
|
|
|
|
#define EFI_NO_TAIL_CALL
|
2024-03-22 17:23:15 +03:00
|
|
|
#endif
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(__clang__)
|
2023-06-22 00:19:54 +03:00
|
|
|
#define EFI_OPTNONE __attribute__((optnone))
|
2024-05-14 14:52:26 +03:00
|
|
|
#elif defined(__GNUC__)
|
2023-06-22 00:19:54 +03:00
|
|
|
#define EFI_OPTNONE __attribute__((__optimize__("0")))
|
2024-05-14 14:52:26 +03:00
|
|
|
#else
|
|
|
|
#define EFI_OPTNONE
|
2023-06-22 00:19:54 +03:00
|
|
|
#endif
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define EFI_ALIGN(x) __attribute__((__aligned__(x)))
|
|
|
|
#elif defined(_MSC_VER)
|
2023-08-12 14:43:40 +03:00
|
|
|
#define EFI_ALIGN(x) __declspec(align(x))
|
2016-03-25 20:32:54 +03:00
|
|
|
#else
|
2024-05-14 14:52:26 +03:00
|
|
|
// Not being able to align is likely to break executables, so report it
|
|
|
|
#error "No alignement directive is defined for this platform"
|
2023-08-12 14:43:40 +03:00
|
|
|
#endif
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if !defined(ALIGN)
|
2023-08-12 14:43:40 +03:00
|
|
|
#define ALIGN(x) EFI_ALIGN(x)
|
2016-03-25 20:32:54 +03:00
|
|
|
#endif
|
|
|
|
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define EFI_NORETURN __attribute__((noreturn))
|
|
|
|
#elif defined(_MSC_VER)
|
2023-08-12 14:58:02 +03:00
|
|
|
#define EFI_NORETURN __declspec(noreturn)
|
|
|
|
#else
|
2024-05-14 14:52:26 +03:00
|
|
|
#define EFI_NORETURN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define EFI_NOINLINE __attribute__((noinline))
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
#define EFI_NOINLINE __declspec(noinline)
|
|
|
|
#else
|
|
|
|
#define EFI_NOINLINE
|
2023-08-12 14:58:02 +03:00
|
|
|
#endif
|
|
|
|
|
2016-03-25 20:32:54 +03:00
|
|
|
/* Also add a catch-all on __attribute__() for MS compilers */
|
2024-05-14 14:52:26 +03:00
|
|
|
#if defined(_MSC_VER)
|
2016-03-25 20:32:54 +03:00
|
|
|
#define __attribute__(x)
|
|
|
|
#endif
|