1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // Test the "test_macros.h" header. 11 #include <__config> 12 #include "test_macros.h" 13 14 #ifndef TEST_STD_VER 15 #error TEST_STD_VER must be defined 16 #endif 17 18 #ifndef TEST_NOEXCEPT 19 #error TEST_NOEXCEPT must be defined 20 #endif 21 22 #ifndef LIBCPP_ASSERT 23 #error LIBCPP_ASSERT must be defined 24 #endif 25 26 #ifndef LIBCPP_STATIC_ASSERT 27 #error LIBCPP_STATIC_ASSERT must be defined 28 #endif 29 30 void test_noexcept() TEST_NOEXCEPT 31 { 32 } 33 34 void test_libcxx_macros() 35 { 36 // ===== C++14 features ===== 37 // defined(TEST_HAS_EXTENDED_CONSTEXPR) != defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 38 #ifdef TEST_HAS_EXTENDED_CONSTEXPR 39 # ifdef _LIBCPP_HAS_NO_CXX14_CONSTEXPR 40 # error "TEST_EXTENDED_CONSTEXPR mismatch (1)" 41 # endif 42 #else 43 # ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR 44 # error "TEST_EXTENDED_CONSTEXPR mismatch (2)" 45 # endif 46 #endif 47 48 // defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 49 #ifdef TEST_HAS_VARIABLE_TEMPLATES 50 # ifdef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 51 # error "TEST_VARIABLE_TEMPLATES mismatch (1)" 52 # endif 53 #else 54 # ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 55 # error "TEST_VARIABLE_TEMPLATES mismatch (2)" 56 # endif 57 #endif 58 59 // ===== C++1z features ===== 60 } 61 62 int main() 63 { 64 test_noexcept(); 65 test_libcxx_macros(); 66 } 67