1 #ifndef __LINUX_COMPILER_H 2 #define __LINUX_COMPILER_H 3 4 /* Somewhere in the middle of the GCC 2.96 development cycle, we implemented 5 a mechanism by which the user can annotate likely branch directions and 6 expect the blocks to be reordered appropriately. Define __builtin_expect 7 to nothing for earlier compilers. */ 8 9 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 10 #define __builtin_expect(x, expected_value) (x) 11 #endif 12 13 #define likely(x) __builtin_expect((x),1) 14 #define unlikely(x) __builtin_expect((x),0) 15 16 #if __GNUC__ > 3 17 #define __attribute_used__ __attribute__((__used__)) 18 #elif __GNUC__ == 3 19 #if __GNUC_MINOR__ >= 3 20 # define __attribute_used__ __attribute__((__used__)) 21 #else 22 # define __attribute_used__ __attribute__((__unused__)) 23 #endif /* __GNUC_MINOR__ >= 3 */ 24 #elif __GNUC__ == 2 25 #define __attribute_used__ __attribute__((__unused__)) 26 #else 27 #define __attribute_used__ /* not implemented */ 28 #endif /* __GNUC__ */ 29 30 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 31 #define __attribute_const__ __attribute__((__const__)) 32 #else 33 #define __attribute_const__ /* unimplemented */ 34 #endif 35 36 #if __GNUC__ == 3 37 #if __GNUC_MINOR__ >= 1 38 # define inline __inline__ __attribute__((always_inline)) 39 # define __inline__ __inline__ __attribute__((always_inline)) 40 # define __inline __inline__ __attribute__((always_inline)) 41 #endif 42 #endif 43 44 #ifdef __KERNEL__ 45 #if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2 46 #error "GCC >= 4.2 miscompiles kernel 2.4, do not use it!" 47 #error "While the resulting kernel may boot, you will encounter random bugs" 48 #error "at runtime. Only versions 2.95.3 to 4.1 are known to work reliably." 49 #error "To build with another version, for instance 3.3, please do" 50 #error " make bzImage CC=gcc-3.3 " 51 #endif 52 #endif 53 54 /* no checker support, so we unconditionally define this as (null) */ 55 #define __user 56 #define __iomem 57 58 #endif /* __LINUX_COMPILER_H */ 59