diff options
author | Max Kellermann <max@duempel.org> | 2014-11-28 19:09:21 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-28 19:09:56 +0100 |
commit | d93172bee81ce18cd3ea4675907d204502d7ff49 (patch) | |
tree | fd138b52de46d524843d046c06fd05b1f10f0c2d /src/Compiler.h | |
parent | 25429af1227469e1b8d1c43d5da8d9d1b109fe8c (diff) | |
download | mpd-d93172bee81ce18cd3ea4675907d204502d7ff49.tar.gz mpd-d93172bee81ce18cd3ea4675907d204502d7ff49.tar.xz mpd-d93172bee81ce18cd3ea4675907d204502d7ff49.zip |
Compiler.h: add macro CLANG_OR_GCC_VERSION()
Diffstat (limited to 'src/Compiler.h')
-rw-r--r-- | src/Compiler.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Compiler.h b/src/Compiler.h index d64ee283b..dc8393dbb 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -32,6 +32,13 @@ (defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) /** + * Are we building with clang (any version) or at least the specified + * gcc version? + */ +#define CLANG_OR_GCC_VERSION(major, minor) \ + (defined(__clang__) || GCC_CHECK_VERSION(major, minor)) + +/** * Are we building with gcc (not clang or any other compiler) and a * version older than the specified one? */ @@ -52,7 +59,7 @@ # warning Untested compiler. Use at your own risk! #endif -#if GCC_CHECK_VERSION(4,0) +#if CLANG_OR_GCC_VERSION(4,0) /* GCC 4.x */ @@ -112,7 +119,7 @@ #endif -#if GCC_CHECK_VERSION(4,3) +#if CLANG_OR_GCC_VERSION(4,3) #define gcc_hot __attribute__((hot)) #define gcc_cold __attribute__((cold)) @@ -133,7 +140,7 @@ #ifndef __cplusplus /* plain C99 has "restrict" */ #define gcc_restrict restrict -#elif GCC_CHECK_VERSION(4,0) +#elif CLANG_OR_GCC_VERSION(4,0) /* "__restrict__" is a GCC extension for C++ */ #define gcc_restrict __restrict__ #else @@ -151,7 +158,7 @@ #define final #endif -#if defined(__clang__) || GCC_CHECK_VERSION(4,8) +#if CLANG_OR_GCC_VERSION(4,8) #define gcc_alignas(T, fallback) alignas(T) #else #define gcc_alignas(T, fallback) gcc_aligned(fallback) |