Go to the documentation of this file. 23 #define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel) 26 # define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 28 # define GCC_VERSION 0 32 # define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) 34 # define CLANG_VERSION 0 41 #define GCC_CHECK_VERSION(major, minor) \ 43 GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) 49 #define CLANG_OR_GCC_VERSION(major, minor) \ 50 (CLANG_VERSION || GCC_CHECK_VERSION(major, minor)) 56 #define GCC_OLDER_THAN(major, minor) \ 57 (GCC_VERSION && !CLANG_VERSION && \ 58 GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0)) 60 #if CLANG_OR_GCC_VERSION(4,0) 64 #define gcc_const __attribute__((const)) 65 #define gcc_deprecated __attribute__((deprecated)) 66 #define gcc_may_alias __attribute__((may_alias)) 67 #define gcc_malloc __attribute__((malloc)) 68 #define gcc_noreturn __attribute__((noreturn)) 69 #define gcc_packed __attribute__((packed)) 70 #define gcc_printf(a,b) __attribute__((format(printf, a, b))) 71 #define gcc_pure __attribute__((pure)) 72 #define gcc_sentinel __attribute__((sentinel)) 73 #define gcc_unused __attribute__((unused)) 74 #define gcc_warn_unused_result __attribute__((warn_unused_result)) 76 #define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) 77 #define gcc_nonnull_all __attribute__((nonnull)) 78 #define gcc_returns_nonnull __attribute__((returns_nonnull)) 80 #define gcc_likely(x) __builtin_expect (!!(x), 1) 81 #define gcc_unlikely(x) __builtin_expect (!!(x), 0) 83 #define gcc_aligned(n) __attribute__((aligned(n))) 85 #define gcc_visibility_hidden __attribute__((visibility("hidden"))) 86 #define gcc_visibility_default __attribute__((visibility("default"))) 88 #define gcc_always_inline __attribute__((always_inline)) 95 #define gcc_deprecated 100 #define gcc_printf(a,b) 104 #define gcc_warn_unused_result 106 #define gcc_nonnull(...) 107 #define gcc_nonnull_all 108 #define gcc_returns_nonnull 110 #define gcc_likely(x) (x) 111 #define gcc_unlikely(x) (x) 113 #define gcc_aligned(n) 115 #define gcc_visibility_hidden 116 #define gcc_visibility_default 118 #define gcc_always_inline inline 122 #if CLANG_OR_GCC_VERSION(4,3) 124 #define gcc_hot __attribute__((hot)) 125 #define gcc_cold __attribute__((cold)) 134 #if GCC_CHECK_VERSION(4,6) 135 #define gcc_flatten __attribute__((flatten)) 142 #define gcc_restrict restrict 143 #elif CLANG_OR_GCC_VERSION(4,0) 145 #define gcc_restrict __restrict__ 153 #if defined(__cplusplus) 156 #if GCC_OLDER_THAN(4,7) 161 #if CLANG_OR_GCC_VERSION(4,8) 162 #define gcc_alignas(T, fallback) alignas(T) 164 #define gcc_alignas(T, fallback) gcc_aligned(fallback) 169 #ifndef __has_feature 171 #define __has_feature(x) 0 174 #if __has_feature(attribute_unused_on_fields) 175 #define gcc_unused_field gcc_unused 177 #define gcc_unused_field 180 #if defined(__GNUC__) || defined(__clang__) 181 #define gcc_unreachable() __builtin_unreachable() 183 #define gcc_unreachable()