Go to the documentation of this file.
62 #ifndef JAS_COMPILER_H
63 #define JAS_COMPILER_H
66 #include <jasper/jas_config.h>
71 # define inline __inline
76 # define JAS_DEPRECATED __attribute__((deprecated))
78 # define JAS_DEPRECATED
82 # define JAS_ATTRIBUTE_CONST __attribute__((const))
84 # define JAS_ATTRIBUTE_CONST
88 # define JAS_ATTRIBUTE_PURE __attribute__((pure))
90 # define JAS_ATTRIBUTE_PURE
94 # define JAS_FORCE_INLINE inline __attribute__((always_inline))
96 # define JAS_FORCE_INLINE inline
100 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
101 # define JAS_UNREACHABLE() __builtin_unreachable()
103 # define JAS_UNREACHABLE()
105 #elif defined(__clang__)
106 # define JAS_UNREACHABLE() __builtin_unreachable()
107 #elif defined(_MSC_VER)
108 # define JAS_UNREACHABLE() __assume(0)
110 # define JAS_UNREACHABLE()
113 #if defined(__GNUC__)
114 # define JAS_LIKELY(x) __builtin_expect (!!(x), 1)
116 # define JAS_LIKELY(x) (x)
119 #if defined(__GNUC__)
120 # define JAS_UNLIKELY(x) __builtin_expect (!!(x), 0)
122 # define JAS_UNLIKELY(x) (x)
125 #if defined(__GNUC__) && __GNUC__ >= 6
126 # define JAS_ATTRIBUTE_DISABLE_UBSAN \
127 __attribute__((no_sanitize_undefined))
128 #elif defined(__clang__)
129 # define JAS_ATTRIBUTE_DISABLE_UBSAN \
130 __attribute__((no_sanitize("undefined")))
132 # define JAS_ATTRIBUTE_DISABLE_UBSAN
136 #define jas_has_builtin(x) __has_builtin(x)
138 #define jas_has_builtin(x) 0
145 #define JAS_UNUSED(x) ((void) x)