From: Max Kellermann Date: Fri, 10 Mar 2017 20:36:23 +0000 (+0100) Subject: Compiler.h: add macro GCC_OLDER_THAN() X-Git-Tag: v0.26~78 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c3d26755af88226a0e9bfef05b0a6fe797c677d1;p=ncmpc.git Compiler.h: add macro GCC_OLDER_THAN() --- diff --git a/src/Compiler.h b/src/Compiler.h index a3a4811..7d19d68 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -38,6 +38,14 @@ # define CLANG_VERSION 0 #endif +/** + * 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) \ + (GCC_VERSION && !CLANG_VERSION && \ + GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0)) + #if GCC_CHECK_VERSION(4,0) /* GCC 4.x */ @@ -132,7 +140,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