| 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++23] |
| 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++23" |
| 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++23" |
| 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++23" |
| 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 |
# ifndef __cpp_lib_bitops |
| 105 |
# error "__cpp_lib_bitops should be defined in c++20" |
| 106 |
# endif |
| 107 |
# if __cpp_lib_bitops != 201907L |
| 108 |
# error "__cpp_lib_bitops should have the value 201907L in c++20" |
| 109 |
# endif |
| 110 |
|
| 111 |
# ifdef __cpp_lib_byteswap |
| 112 |
# error "__cpp_lib_byteswap should not be defined before c++23" |
| 113 |
# endif |
| 114 |
|
| 115 |
# ifndef __cpp_lib_endian |
| 116 |
# error "__cpp_lib_endian should be defined in c++20" |
| 117 |
# endif |
| 118 |
# if __cpp_lib_endian != 201907L |
| 119 |
# error "__cpp_lib_endian should have the value 201907L in c++20" |
| 120 |
# endif |
| 121 |
|
| 122 |
# ifndef __cpp_lib_int_pow2 |
| 123 |
# error "__cpp_lib_int_pow2 should be defined in c++20" |
| 124 |
# endif |
| 125 |
# if __cpp_lib_int_pow2 != 202002L |
| 126 |
# error "__cpp_lib_int_pow2 should have the value 202002L in c++20" |
| 127 |
# endif |
| 128 |
|
| 129 |
#elif TEST_STD_VER == 23 |
| 130 |
|
| 131 |
# ifndef __cpp_lib_bit_cast |
| 132 |
# error "__cpp_lib_bit_cast should be defined in c++23" |
| 133 |
# endif |
| 134 |
# if __cpp_lib_bit_cast != 201806L |
| 135 |
# error "__cpp_lib_bit_cast should have the value 201806L in c++23" |
| 136 |
# endif |
| 137 |
|
| 138 |
# ifndef __cpp_lib_bitops |
| 139 |
# error "__cpp_lib_bitops should be defined in c++23" |
| 140 |
# endif |
| 141 |
# if __cpp_lib_bitops != 201907L |
| 142 |
# error "__cpp_lib_bitops should have the value 201907L in c++23" |
| 143 |
# endif |
| 144 |
|
| 145 |
# ifndef __cpp_lib_byteswap |
| 146 |
# error "__cpp_lib_byteswap should be defined in c++23" |
| 147 |
# endif |
| 148 |
# if __cpp_lib_byteswap != 202110L |
| 149 |
# error "__cpp_lib_byteswap should have the value 202110L in c++23" |
| 150 |
# endif |
| 151 |
|
| 152 |
# ifndef __cpp_lib_endian |
| 153 |
# error "__cpp_lib_endian should be defined in c++23" |
| 154 |
# endif |
| 155 |
# if __cpp_lib_endian != 201907L |
| 156 |
# error "__cpp_lib_endian should have the value 201907L in c++23" |
| 157 |
# endif |
| 158 |
|
| 159 |
# ifndef __cpp_lib_int_pow2 |
| 160 |
# error "__cpp_lib_int_pow2 should be defined in c++23" |
| 161 |
# endif |
| 162 |
# if __cpp_lib_int_pow2 != 202002L |
| 163 |
# error "__cpp_lib_int_pow2 should have the value 202002L in c++23" |
| 164 |
# endif |
| 165 |
|
| 166 |
#elif TEST_STD_VER > 23 |
| 167 |
|
| 168 |
# ifndef __cpp_lib_bit_cast |
| 169 |
# error "__cpp_lib_bit_cast should be defined in c++26" |
| 170 |
# endif |
| 171 |
# if __cpp_lib_bit_cast != 201806L |
| 172 |
# error "__cpp_lib_bit_cast should have the value 201806L in c++26" |
| 173 |
# endif |
| 174 |
|
| 175 |
# ifndef __cpp_lib_bitops |
| 176 |
# error "__cpp_lib_bitops should be defined in c++26" |
| 177 |
# endif |
| 178 |
# if __cpp_lib_bitops != 201907L |
| 179 |
# error "__cpp_lib_bitops should have the value 201907L in c++26" |
| 180 |
# endif |
| 181 |
|
| 182 |
# ifndef __cpp_lib_byteswap |
| 183 |
# error "__cpp_lib_byteswap should be defined in c++26" |
| 184 |
# endif |
| 185 |
# if __cpp_lib_byteswap != 202110L |
| 186 |
# error "__cpp_lib_byteswap should have the value 202110L in c++26" |
| 187 |
# endif |
| 188 |
|
| 189 |
# ifndef __cpp_lib_endian |
| 190 |
# error "__cpp_lib_endian should be defined in c++26" |
| 191 |
# endif |
| 192 |
# if __cpp_lib_endian != 201907L |
| 193 |
# error "__cpp_lib_endian should have the value 201907L in c++26" |
| 194 |
# endif |
| 195 |
|
| 196 |
# ifndef __cpp_lib_int_pow2 |
| 197 |
# error "__cpp_lib_int_pow2 should be defined in c++26" |
| 198 |
# endif |
| 199 |
# if __cpp_lib_int_pow2 != 202002L |
| 200 |
# error "__cpp_lib_int_pow2 should have the value 202002L in c++26" |
| 201 |
# endif |
| 202 |
|
| 203 |
#endif // TEST_STD_VER > 23 |
| 204 |
|