1 #ifndef _TOOLS_LINUX_COMPILER_H_ 2 #define _TOOLS_LINUX_COMPILER_H_ 3 4 /* Optimization barrier */ 5 /* The "volatile" is due to gcc bugs */ 6 #define barrier() __asm__ __volatile__("": : :"memory") 7 8 #ifndef __always_inline 9 # define __always_inline inline __attribute__((always_inline)) 10 #endif 11 12 #define __user 13 14 #ifndef __attribute_const__ 15 # define __attribute_const__ 16 #endif 17 18 #ifndef __maybe_unused 19 # define __maybe_unused __attribute__((unused)) 20 #endif 21 22 #ifndef __packed 23 # define __packed __attribute__((__packed__)) 24 #endif 25 26 #ifndef __force 27 # define __force 28 #endif 29 30 #ifndef __weak 31 # define __weak __attribute__((weak)) 32 #endif 33 34 #ifndef likely 35 # define likely(x) __builtin_expect(!!(x), 1) 36 #endif 37 38 #ifndef unlikely 39 # define unlikely(x) __builtin_expect(!!(x), 0) 40 #endif 41 42 #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) 43 44 #endif /* _TOOLS_LINUX_COMPILER_H */ 45