summaryrefslogtreecommitdiff
path: root/test/support/test_macros.h
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-01-14 04:27:58 +0000
committerEric Fiselier <eric@efcs.ca>2017-01-14 04:27:58 +0000
commit50ca3248fb8ab469698329334f8de1f456d1713f (patch)
tree210c6581def85a4b1d9caeaf3d6e661c5ca30bb7 /test/support/test_macros.h
parentd5904a27648ae30cd25d1a41d11b9be298198bb3 (diff)
Use __is_identifier to detect Clang extensions instead of __has_extension.
When -pedantic-errors is specified `__has_extension(<feature>)` is always false when it would otherwise be true. This causes C++03 <atomic> to break along with other issues. This patch avoids the above problem by using __is_identifier(...) instead since it is not affected by -pedantic-errors. For example instead of checking for __has_extension(c_atomics) we now check `!__is_identifier(_Atomic)`, which is only true when _Atomic is not a keyword provided by the compiler. This patch applies similar changes to the detection logic for __decltype and __nullptr as well. Note that it does not apply this change to the C++03 `static_assert` macro since -Wc11-extensions warnings generated by expanding that macro will appear in user code, and will not be suppressed as part of a system header. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/support/test_macros.h')
-rw-r--r--test/support/test_macros.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index 40d366ab1..f1a0bdd1a 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -13,6 +13,11 @@
#include <ciso646> // Get STL specific macros like _LIBCPP_VERSION
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
+#endif
+
#define TEST_CONCAT1(X, Y) X##Y
#define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y)
@@ -177,4 +182,9 @@ struct is_same<T, T> { enum {value = 1}; };
#endif
#endif
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP