diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-04-28 22:28:23 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-04-28 22:28:23 +0000 |
commit | 1f4231f8cf138c810a55a398c07a422908add70f (patch) | |
tree | 37862fd2450b478ac9fcaf5742d8e2ccdd65be43 /libcxx/test/support/test_macros.h | |
parent | 174f8b19815cef8507fe0dbf03e5e639f3a60ba9 (diff) | |
download | bcm5719-llvm-1f4231f8cf138c810a55a398c07a422908add70f.tar.gz bcm5719-llvm-1f4231f8cf138c810a55a398c07a422908add70f.zip |
Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
llvm-svn: 267947
Diffstat (limited to 'libcxx/test/support/test_macros.h')
-rw-r--r-- | libcxx/test/support/test_macros.h | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 09d878b143c..11b5a5f42bd 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -11,6 +11,8 @@ #ifndef SUPPORT_TEST_MACROS_HPP #define SUPPORT_TEST_MACROS_HPP +#include <ciso646> // Get STL specific macros like _LIBCPP_VERSION + #define TEST_CONCAT1(X, Y) X##Y #define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y) @@ -47,8 +49,6 @@ #if TEST_STD_VER >= 11 #define TEST_HAS_RVALUE_REFERENCES #define TEST_HAS_VARIADIC_TEMPLATES -#define TEST_HAS_INITIALIZER_LISTS -#define TEST_HAS_BASIC_CONSTEXPR #endif /* Features that were introduced in C++14 */ @@ -61,12 +61,6 @@ #if TEST_STD_VER > 14 #endif -#if TEST_HAS_EXTENSION(cxx_decltype) || TEST_STD_VER >= 11 -#define TEST_DECLTYPE(T) decltype(T) -#else -#define TEST_DECLTYPE(T) __typeof__(T) -#endif - #if TEST_STD_VER >= 11 #define TEST_CONSTEXPR constexpr #define TEST_NOEXCEPT noexcept @@ -81,25 +75,6 @@ #define TEST_NOEXCEPT #endif -#if TEST_HAS_EXTENSION(cxx_static_assert) || TEST_STD_VER >= 11 -# define TEST_STATIC_ASSERT(Expr, Msg) static_assert(Expr, Msg) -#else -# define TEST_STATIC_ASSERT(Expr, Msg) \ - typedef ::test_detail::static_assert_check<sizeof( \ - ::test_detail::static_assert_incomplete_test<(Expr)>)> \ - TEST_CONCAT(test_assert, __LINE__) -# -#endif - -namespace test_detail { - -template <bool> struct static_assert_incomplete_test; -template <> struct static_assert_incomplete_test<true> {}; -template <unsigned> struct static_assert_check {}; - -} // end namespace test_detail - - #if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cxx_rtti) #define TEST_HAS_NO_RTTI #endif @@ -113,4 +88,13 @@ template <unsigned> struct static_assert_check {}; #define TEST_HAS_SANITIZERS #endif +/* Macros for testing libc++ specific behavior and extensions */ +#if defined(_LIBCPP_VERSION) +#define LIBCPP_ASSERT(...) assert(__VA_ARGS__) +#define LIBCPP_STATIC_ASSERT(...) static_assert(__VA_ARGS__) +#else +#define LIBCPP_ASSERT(...) ((void)0) +#define LIBCPP_STATIC_ASSERT(...) ((void)0) +#endif + #endif // SUPPORT_TEST_MACROS_HPP |