1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Test the "test_macros.h" header. 10 #include <__config> 11 #include "test_macros.h" 12 13 #ifndef TEST_STD_VER 14 #error TEST_STD_VER must be defined 15 #endif 16 17 #ifndef TEST_NOEXCEPT 18 #error TEST_NOEXCEPT must be defined 19 #endif 20 21 #ifndef LIBCPP_ASSERT 22 #error LIBCPP_ASSERT must be defined 23 #endif 24 25 #ifndef LIBCPP_STATIC_ASSERT 26 #error LIBCPP_STATIC_ASSERT must be defined 27 #endif 28 test_noexcept()29void test_noexcept() TEST_NOEXCEPT 30 { 31 } 32 test_libcxx_macros()33void test_libcxx_macros() 34 { 35 // ===== C++14 features ===== 36 // defined(TEST_HAS_EXTENDED_CONSTEXPR) != defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 37 #ifdef TEST_HAS_EXTENDED_CONSTEXPR 38 # ifdef _LIBCPP_HAS_NO_CXX14_CONSTEXPR 39 # error "TEST_EXTENDED_CONSTEXPR mismatch (1)" 40 # endif 41 #else 42 # ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR 43 # error "TEST_EXTENDED_CONSTEXPR mismatch (2)" 44 # endif 45 #endif 46 47 // defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 48 #ifdef TEST_HAS_VARIABLE_TEMPLATES 49 # ifdef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 50 # error "TEST_VARIABLE_TEMPLATES mismatch (1)" 51 # endif 52 #else 53 # ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 54 # error "TEST_VARIABLE_TEMPLATES mismatch (2)" 55 # endif 56 #endif 57 58 // ===== C++17 features ===== 59 } 60 main(int,char **)61int main(int, char**) 62 { 63 test_noexcept(); 64 test_libcxx_macros(); 65 66 return 0; 67 } 68