diff options
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/assert_checkpoint.h | 8 | ||||
-rw-r--r-- | libcxx/test/support/platform_support.h | 2 | ||||
-rw-r--r-- | libcxx/test/support/test_macros.h | 38 |
3 files changed, 19 insertions, 29 deletions
diff --git a/libcxx/test/support/assert_checkpoint.h b/libcxx/test/support/assert_checkpoint.h index eea78efc39c..c83e0cf25e6 100644 --- a/libcxx/test/support/assert_checkpoint.h +++ b/libcxx/test/support/assert_checkpoint.h @@ -33,7 +33,13 @@ inline void clearCheckpoint() { globalCheckpoint() = Checkpoint{0}; } -#define CHECKPOINT(msg) globalCheckpoint() = Checkpoint{__FILE__, __PRETTY_FUNCTION__, __LINE__, msg} +#if defined(__GNUC__) +#define CHECKPOINT_FUNCTION_NAME __PRETTY_FUNCTION__ +#else +#define CHECKPOINT_FUNCTION_NAME __func__ +#endif + +#define CHECKPOINT(msg) globalCheckpoint() = Checkpoint{__FILE__, CHECKPOINT_FUNCTION_NAME, __LINE__, msg} inline void checkpointSignalHandler(int signal) { if (signal == SIGABRT) { diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 1aec3cdae6d..63311a52144 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/test/support/platform_support.h @@ -91,6 +91,6 @@ get_temp_file_name() return Name; #endif } -#endif // __CloundABI__ +#endif // __CloudABI__ #endif // PLATFORM_SUPPORT_H 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 |