Xen Test Framework
compiler.h
Go to the documentation of this file.
1 #ifndef XTF_COMPILER_H
2 #define XTF_COMPILER_H
3 
4 #ifdef __GNUC__
5 #include <xtf/compiler-gcc.h>
6 #endif
7 
8 #define __alias(x) __attribute__((__alias__(x)))
9 #define __aligned(x) __attribute__((__aligned__(x)))
10 #define __noreturn __attribute__((__noreturn__))
11 #define __packed __attribute__((__packed__))
12 #define __printf(f, v) __attribute__((__format__(__printf__, f, v)))
13 #define __maybe_unused __attribute__((__unused__))
14 #define __used __attribute__((__used__))
15 #define __weak __attribute__((__weak__))
16 
17 #ifndef __noinline /* Avoid conflicting with cdefs.h */
18 #define __noinline __attribute__((__noinline__))
19 #endif
20 
21 #ifndef __always_inline /* Avoid conflicting with cdefs.h */
22 #define __always_inline __attribute__((__always_inline__))
23 #endif
24 
25 #ifndef __section /* Avoid conflicting with cdefs.h */
26 #define __section(s) __attribute__((__section__(s)))
27 #endif
28 
29 #define unreachable() __builtin_unreachable()
30 #define barrier() __asm__ __volatile__ ("" ::: "memory")
31 
32 /* Convenience wrappers. */
33 #define __user_text __section(".text.user")
34 #define __user_data __section(".data.user")
35 
36 #define __page_aligned_data __section(".data.page_aligned") __aligned(4096)
37 #define __page_aligned_bss __section(".bss.page_aligned") __aligned(4096)
38 
39 #define __user_page_aligned_bss \
40  __section(".bss.user.page_aligned") __aligned(4096)
41 
42 #endif /* XTF_COMPILER_H */
43 
44 /*
45  * Local variables:
46  * mode: C
47  * c-file-style: "BSD"
48  * c-basic-offset: 4
49  * tab-width: 4
50  * indent-tabs-mode: nil
51  * End:
52  */