1 #ifndef _U_COMPILER_H_ 2 #define _U_COMPILER_H_ 3 4 /* Function inlining */ 5 #ifndef inline 6 # ifdef __cplusplus 7 /* C++ supports inline keyword */ 8 # elif defined(__GNUC__) 9 # define inline __inline__ 10 # elif defined(_MSC_VER) 11 # define inline __inline 12 # elif defined(__ICL) 13 # define inline __inline 14 # elif defined(__INTEL_COMPILER) 15 /* Intel compiler supports inline keyword */ 16 # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) 17 # define inline __inline 18 # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) 19 /* C99 supports inline keyword */ 20 # elif (__STDC_VERSION__ >= 199901L) 21 /* C99 supports inline keyword */ 22 # else 23 # define inline 24 # endif 25 #endif 26 #ifndef INLINE 27 # define INLINE inline 28 #endif 29 30 /* Function visibility */ 31 #ifndef PUBLIC 32 # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) 33 # define PUBLIC __attribute__((visibility("default"))) 34 # elif defined(_MSC_VER) 35 # define PUBLIC __declspec(dllexport) 36 # else 37 # define PUBLIC 38 # endif 39 #endif 40 41 #ifndef likely 42 # if defined(__GNUC__) 43 # define likely(x) __builtin_expect(!!(x), 1) 44 # define unlikely(x) __builtin_expect(!!(x), 0) 45 # else 46 # define likely(x) (x) 47 # define unlikely(x) (x) 48 # endif 49 #endif 50 51 #endif /* _U_COMPILER_H_ */ 52