1 #ifndef _TOOLS_LINUX_COMPILER_H_
2 #define _TOOLS_LINUX_COMPILER_H_
4 /* Optimization barrier */
5 /* The "volatile" is due to gcc bugs */
6 #define barrier() __asm__ __volatile__("": : :"memory")
8 #ifndef __always_inline
9 # define __always_inline inline __attribute__((always_inline))
14 #ifndef __attribute_const__
15 # define __attribute_const__
18 #ifndef __maybe_unused
19 # define __maybe_unused __attribute__((unused))
23 # define __packed __attribute__((__packed__))
31 # define __weak __attribute__((weak))
35 # define likely(x) __builtin_expect(!!(x), 1)
39 # define unlikely(x) __builtin_expect(!!(x), 0)
42 #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
44 #endif /* _TOOLS_LINUX_COMPILER_H */