From cd6c5cfd4ca0ece2737a7e8c39da2aaa9908cd88 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 28 Nov 2014 19:33:09 +0100 Subject: [PATCH] Compiler.h: exclude clang from GCC_CHECK_VERSION() --- src/Compiler.h | 9 +++++++-- src/fs/AllocatedPath.cxx | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Compiler.h b/src/Compiler.h index 33540368e..ddd1e474f 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -28,8 +28,13 @@ #define GCC_VERSION 0 #endif +/** + * Are we building with the specified version of gcc (not clang or any + * other compiler) or newer? + */ #define GCC_CHECK_VERSION(major, minor) \ - (defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) + (defined(__GNUC__) && !defined(__clang__) && \ + GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) /** * Are we building with clang (any version) or at least the specified @@ -138,7 +143,7 @@ #endif /* ! GCC_UNUSED >= 40300 */ -#if GCC_CHECK_VERSION(4,6) && !defined(__clang__) +#if GCC_CHECK_VERSION(4,6) #define gcc_flatten __attribute__((flatten)) #else #define gcc_flatten diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx index ceaad73ea..0f394dd6e 100644 --- a/src/fs/AllocatedPath.cxx +++ b/src/fs/AllocatedPath.cxx @@ -111,7 +111,7 @@ AllocatedPath::ChopSeparators() while (l >= 2 && PathTraitsFS::IsSeparator(p[l - 1])) { --l; -#if GCC_CHECK_VERSION(4,7) && !defined(__clang__) +#if GCC_CHECK_VERSION(4,7) value.pop_back(); #else value.erase(value.end() - 1, value.end());