From c3d26755af88226a0e9bfef05b0a6fe797c677d1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Mar 2017 21:36:23 +0100 Subject: [PATCH] Compiler.h: add macro GCC_OLDER_THAN() --- src/Compiler.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.30.2