diff options
Diffstat (limited to 'test/support/test_macros.h')
| -rw-r--r-- | test/support/test_macros.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/support/test_macros.h b/test/support/test_macros.h index a08ca87be935..c34e8cf7ef14 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -14,12 +14,24 @@ #define TEST_CONCAT1(X, Y) X##Y #define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y) +#ifdef __has_feature +#define TEST_HAS_FEATURE(X) __has_feature(X) +#else +#define TEST_HAS_FEATURE(X) 0 +#endif + #ifdef __has_extension #define TEST_HAS_EXTENSION(X) __has_extension(X) #else #define TEST_HAS_EXTENSION(X) 0 #endif +#ifdef __has_builtin +#define TEST_HAS_BUILTIN(X) __has_builtin(X) +#else +#define TEST_HAS_BUILTIN(X) 0 +#endif + /* Make a nice name for the standard version */ #if __cplusplus <= 199711L # define TEST_STD_VER 3 @@ -56,8 +68,10 @@ #endif #if TEST_STD_VER >= 11 +#define TEST_CONSTEXPR constexpr #define TEST_NOEXCEPT noexcept #else +#define TEST_CONSTEXPR #define TEST_NOEXCEPT #endif @@ -80,4 +94,17 @@ 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 + +#if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cxx_exceptions) +#define TEST_HAS_NO_EXCEPTIONS +#endif + +#if TEST_HAS_FEATURE(address_sanitizer) || TEST_HAS_FEATURE(memory_sanitizer) || \ + TEST_HAS_FEATURE(thread_sanitizer) +#define TEST_HAS_SANITIZERS +#endif + #endif // SUPPORT_TEST_MACROS_HPP |
