18 #ifndef LUNCHBOX_COMPILER_H
19 #define LUNCHBOX_COMPILER_H
22 # include <boost/config.hpp>
25 # if !defined(CXX_NULLPTR_SUPPORTED) && !defined(nullptr)
28 # ifndef CXX_FINAL_OVERRIDE_SUPPORTED
40 # define LB_ALIGN8( var ) __declspec (align (8)) var;
41 # define LB_ALIGN16( var ) __declspec (align (16)) var;
43 # define LB_BIGEENDIAN
45 # define LB_LITTLEENDIAN
47 #elif defined (__GNUC__)
48 # define LB_ALIGN8( var ) var __attribute__ ((aligned (8)));
49 # define LB_ALIGN16( var ) var __attribute__ ((aligned (16)));
50 # define LB_UNUSED __attribute__((unused))
51 # define LB_LIKELY(x) __builtin_expect( (x), 1 )
52 # define LB_UNLIKELY(x) __builtin_expect( (x), 0 )
53 # ifdef WARN_DEPRECATED // Set CMake option ENABLE_WARN_DEPRECATED
54 # define LB_DEPRECATED __attribute__((deprecated))
56 # ifdef __BIG_ENDIAN__
57 # define LB_BIGEENDIAN
59 # define LB_LITTLEENDIAN
61 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 0)) )
62 # define LB_GCC_4_0_OR_LATER
64 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) )
65 # define LB_GCC_4_1_OR_LATER
67 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) )
68 # define LB_GCC_4_2_OR_LATER
70 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) )
71 # define LB_GCC_4_3_OR_LATER
73 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) )
74 # define LB_GCC_4_4_OR_LATER
76 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) )
77 # define LB_GCC_4_5_OR_LATER
79 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) )
80 # define LB_GCC_4_6_OR_LATER
82 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) )
83 # define LB_GCC_4_7_OR_LATER
85 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) )
86 # define LB_GCC_4_8_OR_LATER
88 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) )
89 # define LB_GCC_4_9_OR_LATER
91 # if (( __GNUC__ < 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) )
92 # define LB_GCC_4_3_OR_OLDER
95 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 2))
98 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 3))
101 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 4))
104 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 5))
107 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
110 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 7))
113 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 8))
116 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 9))
120 # warning Unknown compiler, taking guesses
121 # define LB_ALIGN8( var ) var __attribute__ ((aligned (8)));
122 # define LB_ALIGN16( var ) var __attribute__ ((aligned (16)));
123 # ifdef __BIG_ENDIAN__
124 # define LB_BIGEENDIAN
126 # define LB_LITTLEENDIAN
134 # define LB_LIKELY(x) x
135 # define LB_UNLIKELY(x) x
138 # define LB_PUSH_DEPRECATED \
139 _Pragma("clang diagnostic push") \
140 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
141 _Pragma("GCC diagnostic push") \
142 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
144 # define LB_POP_DEPRECATED \
145 _Pragma("clang diagnostic pop") \
146 _Pragma("GCC diagnostic pop")
148 # define LB_DEPRECATED
149 # define LB_PUSH_DEPRECATED
150 # define LB_POP_DEPRECATED
153 #endif //LUNCHBOX_COMPILER_H