xref: /DragonStub/inc/eficompiler.h (revision f412fd2a1a248b546b7085648dece8d908077fab)
1 /*++
2 
3 Copyright (c) 2016 Pete Batard <pete@akeo.ie>
4 
5 Module Name:
6 
7     eficompiler.h
8 
9 Abstract:
10 
11     Compiler specific adjustments
12 
13 --*/
14 
15 #ifdef _MSC_EXTENSIONS
16 #define EFI_UNUSED
17 #else
18 #define EFI_UNUSED __attribute__((__unused__))
19 #endif
20 
21 #ifdef _MSC_EXTENSIONS
22 #define EFI_NO_TAIL_CALL
23 #else
24 #ifdef __clang__
25 #define EFI_NO_TAIL_CALL __attribute__((disable_tail_calls))
26 #else
27 #define EFI_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls")))
28 #endif
29 #endif
30 
31 #ifdef _MSC_EXTENSIONS
32 #define EFI_OPTNONE
33 #else
34 #ifdef __clang__
35 #define EFI_OPTNONE __attribute__((optnone))
36 #else
37 #define EFI_OPTNONE __attribute__((__optimize__("0")))
38 #endif
39 #endif
40 
41 #ifdef _MSC_EXTENSIONS
42 #define ALIGN(x) __declspec(align(x))
43 #else
44 #define ALIGN(x) __attribute__((__aligned__(x)))
45 #endif
46 
47 /* Also add a catch-all on __attribute__() for MS compilers */
48 #ifdef _MSC_EXTENSIONS
49 #define __attribute__(x)
50 #endif
51