Branch data Line data Source code
1 : : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2 : : /* Copyright 2013-2019 IBM Corp. */
3 : :
4 : : #ifndef __COMPILER_H
5 : : #define __COMPILER_H
6 : :
7 : : #ifndef __ASSEMBLY__
8 : :
9 : : #include <stddef.h>
10 : :
11 : : /* Macros for various compiler bits and pieces */
12 : : #define __packed __attribute__((packed))
13 : : #define __align(x) __attribute__((__aligned__(x)))
14 : : #define __unused __attribute__((unused))
15 : : #define __used __attribute__((used))
16 : : #define __section(x) __attribute__((__section__(x)))
17 : : #define __noreturn __attribute__((noreturn))
18 : : /* not __const as this has a different meaning (const) */
19 : : #define __attrconst __attribute__((const))
20 : : #define __warn_unused_result __attribute__((warn_unused_result))
21 : : #define __noinline __attribute__((noinline))
22 : :
23 : : #if 0 /* Provided by gcc stddef.h */
24 : : #define offsetof(type,m) __builtin_offsetof(type,m)
25 : : #endif
26 : :
27 : : #define __nomcount __attribute__((no_instrument_function))
28 : :
29 : : /* Compiler barrier */
30 : 0 : static inline void barrier(void)
31 : : {
32 : 0 : asm volatile("" : : : "memory");
33 : 0 : }
34 : :
35 : : #endif /* __ASSEMBLY__ */
36 : :
37 : : /* Stringification macro */
38 : : #define __tostr(x) #x
39 : : #define tostr(x) __tostr(x)
40 : :
41 : :
42 : : #if __GNUC__ >= 11
43 : : /* Compiler workaround to avoid compiler optimization warnings
44 : : * when assigning constant address to pointer and using memory
45 : : * functions such as memcpy and memset
46 : : */
47 : : #define skiboot_constant_addr volatile
48 : : #else
49 : : #define skiboot_constant_addr
50 : : #endif
51 : :
52 : :
53 : : #endif /* __COMPILER_H */
|