aboutsummaryrefslogtreecommitdiffstats
path: root/src/Compiler.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-28 18:57:48 +0100
committerMax Kellermann <max@duempel.org>2014-12-26 13:30:44 +0100
commit0964b06240947e94fc2732107815fff41856d481 (patch)
treef9828f651f8c1d88e9abf4914704dbc2edc10398 /src/Compiler.h
parent92eeca3ba77446b760d3d64d9c50a08029bd4500 (diff)
downloadmpd-0964b06240947e94fc2732107815fff41856d481.tar.gz
mpd-0964b06240947e94fc2732107815fff41856d481.tar.xz
mpd-0964b06240947e94fc2732107815fff41856d481.zip
Compiler.h: add macro GCC_OLDER_THAN()
Diffstat (limited to 'src/Compiler.h')
-rw-r--r--src/Compiler.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Compiler.h b/src/Compiler.h
index 14dd5d248..82a192394 100644
--- a/src/Compiler.h
+++ b/src/Compiler.h
@@ -31,13 +31,21 @@
#define GCC_CHECK_VERSION(major, minor) \
(defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
+/**
+ * Are we building with gcc (not clang or any other compiler) and a
+ * version older than the specified one?
+ */
+#define GCC_OLDER_THAN(major, minor) \
+ (defined(__GNUC__) && !defined(__clang__) && \
+ GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
+
#ifdef __clang__
# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
# if __clang_major__ < 3
# error Sorry, your clang version is too old. You need at least version 3.1.
# endif
#elif defined(__GNUC__)
-# if !GCC_CHECK_VERSION(4,6)
+# if GCC_OLDER_THAN(4,6)
# error Sorry, your gcc version is too old. You need at least version 4.6.
# endif
#else
@@ -138,7 +146,7 @@
#if defined(__cplusplus)
/* support for C++11 "override" was added in gcc 4.7 */
-#if !defined(__clang__) && !GCC_CHECK_VERSION(4,7)
+#if GCC_OLDER_THAN(4,7)
#define override
#define final
#endif