From 7f1b098ab44ba6494b077b001e9bfe3bfb20ebd8 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 20 Jul 2016 22:53:21 +0000 Subject: [PATCH] Unbreak traits tests by handling differences between version macros in clang/apple-clang. llvm-svn: 276200 --- .../meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp | 3 ++- .../meta.unary/meta.unary.prop/is_default_constructible.pass.cpp | 3 ++- libcxx/test/support/test_macros.h | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 6f3474c..7235538 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -157,7 +157,8 @@ int main() // TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly. // In those compiler versions the __is_constructible builtin gives the wrong // results for abominable function types. -#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ < 8 +#if (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 703) \ + || (defined(TEST_CLANG_VER) && TEST_CLANG_VER < 308) #define WORKAROUND_CLANG_BUG #endif #if !defined(WORKAROUND_CLANG_BUG) diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp index 52b45cd..22755dc 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp @@ -111,7 +111,8 @@ int main() // TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly. // In those compiler versions the __is_constructible builtin gives the wrong // results for abominable function types. -#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ < 8 +#if (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 703) \ + || (defined(TEST_CLANG_VER) && TEST_CLANG_VER < 308) #define WORKAROUND_CLANG_BUG #endif #if !defined(WORKAROUND_CLANG_BUG) diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index a072e31..3e4400a 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -34,6 +34,14 @@ #define TEST_HAS_BUILTIN(X) 0 #endif +#if defined(__apple_build_version__) +#define TEST_APPLE_CLANG_VER (__clang_major__ * 100) + __clang_minor__ +#elif defined(__clang_major__) +#define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__ +#elif defined(__GNUC__) +#define TEST_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +#endif + /* Make a nice name for the standard version */ #ifndef TEST_STD_VER #if __cplusplus <= 199711L -- 2.7.4