18 #ifndef LUNCHBOX_COMPILER_H
19 #define LUNCHBOX_COMPILER_H
22 # include <boost/config.hpp>
25 # ifndef CXX_NULLPTR_SUPPORTED
29 # ifndef CXX_FINAL_OVERRIDE_SUPPORTED
36 # define LB_ALIGN8( var ) __declspec (align (8)) var;
37 # define LB_ALIGN16( var ) __declspec (align (16)) var;
43 # define LB_ALIGN8( var ) var __attribute__ ((aligned (8)));
48 # define LB_ALIGN16( var ) var __attribute__ ((aligned (16)));
52 # define LB_UNUSED __attribute__((unused))
53 # ifdef WARN_DEPRECATED // Set CMake option ENABLE_WARN_DEPRECATED
54 # define LB_DEPRECATED __attribute__((deprecated))
56 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 0)) )
57 # define LB_GCC_4_0_OR_LATER
59 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) )
60 # define LB_GCC_4_1_OR_LATER
62 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) )
63 # define LB_GCC_4_2_OR_LATER
65 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) )
66 # define LB_GCC_4_3_OR_LATER
68 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) )
69 # define LB_GCC_4_4_OR_LATER
71 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) )
72 # define LB_GCC_4_5_OR_LATER
74 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) )
75 # define LB_GCC_4_6_OR_LATER
77 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) )
78 # define LB_GCC_4_7_OR_LATER
80 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) )
81 # define LB_GCC_4_8_OR_LATER
83 # if (( __GNUC__ > 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) )
84 # define LB_GCC_4_9_OR_LATER
87 # if (( __GNUC__ < 4 ) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) )
88 # define LB_GCC_4_3_OR_OLDER
91 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 2))
94 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 3))
97 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 4))
100 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 5))
103 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
106 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 7))
109 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 8))
112 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 9))
122 # define LB_PUSH_DEPRECATED \
123 _Pragma("clang diagnostic push") \
124 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
125 _Pragma("GCC diagnostic push") \
126 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
128 # define LB_POP_DEPRECATED \
129 _Pragma("clang diagnostic pop") \
130 _Pragma("GCC diagnostic pop")
132 # define LB_DEPRECATED
133 # define LB_PUSH_DEPRECATED
134 # define LB_POP_DEPRECATED
138 # define LB_LIKELY(x) __builtin_expect( (x), 1 )
139 # define LB_UNLIKELY(x) __builtin_expect( (x), 0 )
141 # define LB_LIKELY(x) x
142 # define LB_UNLIKELY(x) x
145 #endif //LUNCHBOX_COMPILER_H