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 // WARNING: This test was generated by generate_feature_test_macro_components.py 10 // and should not be edited manually. 11 // 12 // clang-format off 13 14 // <bit> 15 16 // Test the feature test macros defined by <bit> 17 18 /* Constant Value 19 __cpp_lib_bit_cast 201806L [C++20] 20 __cpp_lib_bitops 201907L [C++20] 21 __cpp_lib_byteswap 202110L [C++2b] 22 __cpp_lib_endian 201907L [C++20] 23 __cpp_lib_int_pow2 202002L [C++20] 24 */ 25 26 #include <bit> 27 #include "test_macros.h" 28 29 #if TEST_STD_VER < 14 30 31 # ifdef __cpp_lib_bit_cast 32 # error "__cpp_lib_bit_cast should not be defined before c++20" 33 # endif 34 35 # ifdef __cpp_lib_bitops 36 # error "__cpp_lib_bitops should not be defined before c++20" 37 # endif 38 39 # ifdef __cpp_lib_byteswap 40 # error "__cpp_lib_byteswap should not be defined before c++2b" 41 # endif 42 43 # ifdef __cpp_lib_endian 44 # error "__cpp_lib_endian should not be defined before c++20" 45 # endif 46 47 # ifdef __cpp_lib_int_pow2 48 # error "__cpp_lib_int_pow2 should not be defined before c++20" 49 # endif 50 51 #elif TEST_STD_VER == 14 52 53 # ifdef __cpp_lib_bit_cast 54 # error "__cpp_lib_bit_cast should not be defined before c++20" 55 # endif 56 57 # ifdef __cpp_lib_bitops 58 # error "__cpp_lib_bitops should not be defined before c++20" 59 # endif 60 61 # ifdef __cpp_lib_byteswap 62 # error "__cpp_lib_byteswap should not be defined before c++2b" 63 # endif 64 65 # ifdef __cpp_lib_endian 66 # error "__cpp_lib_endian should not be defined before c++20" 67 # endif 68 69 # ifdef __cpp_lib_int_pow2 70 # error "__cpp_lib_int_pow2 should not be defined before c++20" 71 # endif 72 73 #elif TEST_STD_VER == 17 74 75 # ifdef __cpp_lib_bit_cast 76 # error "__cpp_lib_bit_cast should not be defined before c++20" 77 # endif 78 79 # ifdef __cpp_lib_bitops 80 # error "__cpp_lib_bitops should not be defined before c++20" 81 # endif 82 83 # ifdef __cpp_lib_byteswap 84 # error "__cpp_lib_byteswap should not be defined before c++2b" 85 # endif 86 87 # ifdef __cpp_lib_endian 88 # error "__cpp_lib_endian should not be defined before c++20" 89 # endif 90 91 # ifdef __cpp_lib_int_pow2 92 # error "__cpp_lib_int_pow2 should not be defined before c++20" 93 # endif 94 95 #elif TEST_STD_VER == 20 96 97 # ifndef __cpp_lib_bit_cast 98 # error "__cpp_lib_bit_cast should be defined in c++20" 99 # endif 100 # if __cpp_lib_bit_cast != 201806L 101 # error "__cpp_lib_bit_cast should have the value 201806L in c++20" 102 # endif 103 104 # if !defined(_LIBCPP_VERSION) 105 # ifndef __cpp_lib_bitops 106 # error "__cpp_lib_bitops should be defined in c++20" 107 # endif 108 # if __cpp_lib_bitops != 201907L 109 # error "__cpp_lib_bitops should have the value 201907L in c++20" 110 # endif 111 # else // _LIBCPP_VERSION 112 # ifdef __cpp_lib_bitops 113 # error "__cpp_lib_bitops should not be defined because it is unimplemented in libc++!" 114 # endif 115 # endif 116 117 # ifdef __cpp_lib_byteswap 118 # error "__cpp_lib_byteswap should not be defined before c++2b" 119 # endif 120 121 # ifndef __cpp_lib_endian 122 # error "__cpp_lib_endian should be defined in c++20" 123 # endif 124 # if __cpp_lib_endian != 201907L 125 # error "__cpp_lib_endian should have the value 201907L in c++20" 126 # endif 127 128 # ifndef __cpp_lib_int_pow2 129 # error "__cpp_lib_int_pow2 should be defined in c++20" 130 # endif 131 # if __cpp_lib_int_pow2 != 202002L 132 # error "__cpp_lib_int_pow2 should have the value 202002L in c++20" 133 # endif 134 135 #elif TEST_STD_VER > 20 136 137 # ifndef __cpp_lib_bit_cast 138 # error "__cpp_lib_bit_cast should be defined in c++2b" 139 # endif 140 # if __cpp_lib_bit_cast != 201806L 141 # error "__cpp_lib_bit_cast should have the value 201806L in c++2b" 142 # endif 143 144 # if !defined(_LIBCPP_VERSION) 145 # ifndef __cpp_lib_bitops 146 # error "__cpp_lib_bitops should be defined in c++2b" 147 # endif 148 # if __cpp_lib_bitops != 201907L 149 # error "__cpp_lib_bitops should have the value 201907L in c++2b" 150 # endif 151 # else // _LIBCPP_VERSION 152 # ifdef __cpp_lib_bitops 153 # error "__cpp_lib_bitops should not be defined because it is unimplemented in libc++!" 154 # endif 155 # endif 156 157 # ifndef __cpp_lib_byteswap 158 # error "__cpp_lib_byteswap should be defined in c++2b" 159 # endif 160 # if __cpp_lib_byteswap != 202110L 161 # error "__cpp_lib_byteswap should have the value 202110L in c++2b" 162 # endif 163 164 # ifndef __cpp_lib_endian 165 # error "__cpp_lib_endian should be defined in c++2b" 166 # endif 167 # if __cpp_lib_endian != 201907L 168 # error "__cpp_lib_endian should have the value 201907L in c++2b" 169 # endif 170 171 # ifndef __cpp_lib_int_pow2 172 # error "__cpp_lib_int_pow2 should be defined in c++2b" 173 # endif 174 # if __cpp_lib_int_pow2 != 202002L 175 # error "__cpp_lib_int_pow2 should have the value 202002L in c++2b" 176 # endif 177 178 #endif // TEST_STD_VER > 20 179 180