| 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 | // <atomic> |
| 13 | |
| 14 | // Test the feature test macros defined by <atomic> |
| 15 | |
| 16 | // clang-format off |
| 17 | |
| 18 | #include <atomic> |
| 19 | #include "test_macros.h" |
| 20 | |
| 21 | #if TEST_STD_VER < 14 |
| 22 | |
| 23 | # ifdef __cpp_lib_atomic_flag_test |
| 24 | # error "__cpp_lib_atomic_flag_test should not be defined before c++20" |
| 25 | # endif |
| 26 | |
| 27 | # ifdef __cpp_lib_atomic_float |
| 28 | # error "__cpp_lib_atomic_float should not be defined before c++20" |
| 29 | # endif |
| 30 | |
| 31 | # ifdef __cpp_lib_atomic_is_always_lock_free |
| 32 | # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17" |
| 33 | # endif |
| 34 | |
| 35 | # ifdef __cpp_lib_atomic_lock_free_type_aliases |
| 36 | # error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20" |
| 37 | # endif |
| 38 | |
| 39 | # ifdef __cpp_lib_atomic_min_max |
| 40 | # error "__cpp_lib_atomic_min_max should not be defined before c++26" |
| 41 | # endif |
| 42 | |
| 43 | # ifdef __cpp_lib_atomic_ref |
| 44 | # error "__cpp_lib_atomic_ref should not be defined before c++20" |
| 45 | # endif |
| 46 | |
| 47 | # ifdef __cpp_lib_atomic_shared_ptr |
| 48 | # error "__cpp_lib_atomic_shared_ptr should not be defined before c++20" |
| 49 | # endif |
| 50 | |
| 51 | # ifdef __cpp_lib_atomic_value_initialization |
| 52 | # error "__cpp_lib_atomic_value_initialization should not be defined before c++20" |
| 53 | # endif |
| 54 | |
| 55 | # ifdef __cpp_lib_atomic_wait |
| 56 | # error "__cpp_lib_atomic_wait should not be defined before c++20" |
| 57 | # endif |
| 58 | |
| 59 | # ifdef __cpp_lib_char8_t |
| 60 | # error "__cpp_lib_char8_t should not be defined before c++20" |
| 61 | # endif |
| 62 | |
| 63 | #elif TEST_STD_VER == 14 |
| 64 | |
| 65 | # ifdef __cpp_lib_atomic_flag_test |
| 66 | # error "__cpp_lib_atomic_flag_test should not be defined before c++20" |
| 67 | # endif |
| 68 | |
| 69 | # ifdef __cpp_lib_atomic_float |
| 70 | # error "__cpp_lib_atomic_float should not be defined before c++20" |
| 71 | # endif |
| 72 | |
| 73 | # ifdef __cpp_lib_atomic_is_always_lock_free |
| 74 | # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17" |
| 75 | # endif |
| 76 | |
| 77 | # ifdef __cpp_lib_atomic_lock_free_type_aliases |
| 78 | # error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20" |
| 79 | # endif |
| 80 | |
| 81 | # ifdef __cpp_lib_atomic_min_max |
| 82 | # error "__cpp_lib_atomic_min_max should not be defined before c++26" |
| 83 | # endif |
| 84 | |
| 85 | # ifdef __cpp_lib_atomic_ref |
| 86 | # error "__cpp_lib_atomic_ref should not be defined before c++20" |
| 87 | # endif |
| 88 | |
| 89 | # ifdef __cpp_lib_atomic_shared_ptr |
| 90 | # error "__cpp_lib_atomic_shared_ptr should not be defined before c++20" |
| 91 | # endif |
| 92 | |
| 93 | # ifdef __cpp_lib_atomic_value_initialization |
| 94 | # error "__cpp_lib_atomic_value_initialization should not be defined before c++20" |
| 95 | # endif |
| 96 | |
| 97 | # ifdef __cpp_lib_atomic_wait |
| 98 | # error "__cpp_lib_atomic_wait should not be defined before c++20" |
| 99 | # endif |
| 100 | |
| 101 | # ifdef __cpp_lib_char8_t |
| 102 | # error "__cpp_lib_char8_t should not be defined before c++20" |
| 103 | # endif |
| 104 | |
| 105 | #elif TEST_STD_VER == 17 |
| 106 | |
| 107 | # ifdef __cpp_lib_atomic_flag_test |
| 108 | # error "__cpp_lib_atomic_flag_test should not be defined before c++20" |
| 109 | # endif |
| 110 | |
| 111 | # ifdef __cpp_lib_atomic_float |
| 112 | # error "__cpp_lib_atomic_float should not be defined before c++20" |
| 113 | # endif |
| 114 | |
| 115 | # ifndef __cpp_lib_atomic_is_always_lock_free |
| 116 | # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17" |
| 117 | # endif |
| 118 | # if __cpp_lib_atomic_is_always_lock_free != 201603L |
| 119 | # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17" |
| 120 | # endif |
| 121 | |
| 122 | # ifdef __cpp_lib_atomic_lock_free_type_aliases |
| 123 | # error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20" |
| 124 | # endif |
| 125 | |
| 126 | # ifdef __cpp_lib_atomic_min_max |
| 127 | # error "__cpp_lib_atomic_min_max should not be defined before c++26" |
| 128 | # endif |
| 129 | |
| 130 | # ifdef __cpp_lib_atomic_ref |
| 131 | # error "__cpp_lib_atomic_ref should not be defined before c++20" |
| 132 | # endif |
| 133 | |
| 134 | # ifdef __cpp_lib_atomic_shared_ptr |
| 135 | # error "__cpp_lib_atomic_shared_ptr should not be defined before c++20" |
| 136 | # endif |
| 137 | |
| 138 | # ifdef __cpp_lib_atomic_value_initialization |
| 139 | # error "__cpp_lib_atomic_value_initialization should not be defined before c++20" |
| 140 | # endif |
| 141 | |
| 142 | # ifdef __cpp_lib_atomic_wait |
| 143 | # error "__cpp_lib_atomic_wait should not be defined before c++20" |
| 144 | # endif |
| 145 | |
| 146 | # ifdef __cpp_lib_char8_t |
| 147 | # error "__cpp_lib_char8_t should not be defined before c++20" |
| 148 | # endif |
| 149 | |
| 150 | #elif TEST_STD_VER == 20 |
| 151 | |
| 152 | # ifndef __cpp_lib_atomic_flag_test |
| 153 | # error "__cpp_lib_atomic_flag_test should be defined in c++20" |
| 154 | # endif |
| 155 | # if __cpp_lib_atomic_flag_test != 201907L |
| 156 | # error "__cpp_lib_atomic_flag_test should have the value 201907L in c++20" |
| 157 | # endif |
| 158 | |
| 159 | # ifndef __cpp_lib_atomic_float |
| 160 | # error "__cpp_lib_atomic_float should be defined in c++20" |
| 161 | # endif |
| 162 | # if __cpp_lib_atomic_float != 201711L |
| 163 | # error "__cpp_lib_atomic_float should have the value 201711L in c++20" |
| 164 | # endif |
| 165 | |
| 166 | # ifndef __cpp_lib_atomic_is_always_lock_free |
| 167 | # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++20" |
| 168 | # endif |
| 169 | # if __cpp_lib_atomic_is_always_lock_free != 201603L |
| 170 | # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++20" |
| 171 | # endif |
| 172 | |
| 173 | # ifndef __cpp_lib_atomic_lock_free_type_aliases |
| 174 | # error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++20" |
| 175 | # endif |
| 176 | # if __cpp_lib_atomic_lock_free_type_aliases != 201907L |
| 177 | # error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++20" |
| 178 | # endif |
| 179 | |
| 180 | # ifdef __cpp_lib_atomic_min_max |
| 181 | # error "__cpp_lib_atomic_min_max should not be defined before c++26" |
| 182 | # endif |
| 183 | |
| 184 | # ifndef __cpp_lib_atomic_ref |
| 185 | # error "__cpp_lib_atomic_ref should be defined in c++20" |
| 186 | # endif |
| 187 | # if __cpp_lib_atomic_ref != 201806L |
| 188 | # error "__cpp_lib_atomic_ref should have the value 201806L in c++20" |
| 189 | # endif |
| 190 | |
| 191 | # if !defined(_LIBCPP_VERSION) |
| 192 | # ifndef __cpp_lib_atomic_shared_ptr |
| 193 | # error "__cpp_lib_atomic_shared_ptr should be defined in c++20" |
| 194 | # endif |
| 195 | # if __cpp_lib_atomic_shared_ptr != 201711L |
| 196 | # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++20" |
| 197 | # endif |
| 198 | # else |
| 199 | # ifdef __cpp_lib_atomic_shared_ptr |
| 200 | # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!" |
| 201 | # endif |
| 202 | # endif |
| 203 | |
| 204 | # ifndef __cpp_lib_atomic_value_initialization |
| 205 | # error "__cpp_lib_atomic_value_initialization should be defined in c++20" |
| 206 | # endif |
| 207 | # if __cpp_lib_atomic_value_initialization != 201911L |
| 208 | # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++20" |
| 209 | # endif |
| 210 | |
| 211 | # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC |
| 212 | # ifndef __cpp_lib_atomic_wait |
| 213 | # error "__cpp_lib_atomic_wait should be defined in c++20" |
| 214 | # endif |
| 215 | # if __cpp_lib_atomic_wait != 201907L |
| 216 | # error "__cpp_lib_atomic_wait should have the value 201907L in c++20" |
| 217 | # endif |
| 218 | # else |
| 219 | # ifdef __cpp_lib_atomic_wait |
| 220 | # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!" |
| 221 | # endif |
| 222 | # endif |
| 223 | |
| 224 | # if defined(__cpp_char8_t) |
| 225 | # ifndef __cpp_lib_char8_t |
| 226 | # error "__cpp_lib_char8_t should be defined in c++20" |
| 227 | # endif |
| 228 | # if __cpp_lib_char8_t != 201907L |
| 229 | # error "__cpp_lib_char8_t should have the value 201907L in c++20" |
| 230 | # endif |
| 231 | # else |
| 232 | # ifdef __cpp_lib_char8_t |
| 233 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 234 | # endif |
| 235 | # endif |
| 236 | |
| 237 | #elif TEST_STD_VER == 23 |
| 238 | |
| 239 | # ifndef __cpp_lib_atomic_flag_test |
| 240 | # error "__cpp_lib_atomic_flag_test should be defined in c++23" |
| 241 | # endif |
| 242 | # if __cpp_lib_atomic_flag_test != 201907L |
| 243 | # error "__cpp_lib_atomic_flag_test should have the value 201907L in c++23" |
| 244 | # endif |
| 245 | |
| 246 | # ifndef __cpp_lib_atomic_float |
| 247 | # error "__cpp_lib_atomic_float should be defined in c++23" |
| 248 | # endif |
| 249 | # if __cpp_lib_atomic_float != 201711L |
| 250 | # error "__cpp_lib_atomic_float should have the value 201711L in c++23" |
| 251 | # endif |
| 252 | |
| 253 | # ifndef __cpp_lib_atomic_is_always_lock_free |
| 254 | # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++23" |
| 255 | # endif |
| 256 | # if __cpp_lib_atomic_is_always_lock_free != 201603L |
| 257 | # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++23" |
| 258 | # endif |
| 259 | |
| 260 | # ifndef __cpp_lib_atomic_lock_free_type_aliases |
| 261 | # error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++23" |
| 262 | # endif |
| 263 | # if __cpp_lib_atomic_lock_free_type_aliases != 201907L |
| 264 | # error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++23" |
| 265 | # endif |
| 266 | |
| 267 | # ifdef __cpp_lib_atomic_min_max |
| 268 | # error "__cpp_lib_atomic_min_max should not be defined before c++26" |
| 269 | # endif |
| 270 | |
| 271 | # ifndef __cpp_lib_atomic_ref |
| 272 | # error "__cpp_lib_atomic_ref should be defined in c++23" |
| 273 | # endif |
| 274 | # if __cpp_lib_atomic_ref != 201806L |
| 275 | # error "__cpp_lib_atomic_ref should have the value 201806L in c++23" |
| 276 | # endif |
| 277 | |
| 278 | # if !defined(_LIBCPP_VERSION) |
| 279 | # ifndef __cpp_lib_atomic_shared_ptr |
| 280 | # error "__cpp_lib_atomic_shared_ptr should be defined in c++23" |
| 281 | # endif |
| 282 | # if __cpp_lib_atomic_shared_ptr != 201711L |
| 283 | # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++23" |
| 284 | # endif |
| 285 | # else |
| 286 | # ifdef __cpp_lib_atomic_shared_ptr |
| 287 | # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!" |
| 288 | # endif |
| 289 | # endif |
| 290 | |
| 291 | # ifndef __cpp_lib_atomic_value_initialization |
| 292 | # error "__cpp_lib_atomic_value_initialization should be defined in c++23" |
| 293 | # endif |
| 294 | # if __cpp_lib_atomic_value_initialization != 201911L |
| 295 | # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++23" |
| 296 | # endif |
| 297 | |
| 298 | # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC |
| 299 | # ifndef __cpp_lib_atomic_wait |
| 300 | # error "__cpp_lib_atomic_wait should be defined in c++23" |
| 301 | # endif |
| 302 | # if __cpp_lib_atomic_wait != 201907L |
| 303 | # error "__cpp_lib_atomic_wait should have the value 201907L in c++23" |
| 304 | # endif |
| 305 | # else |
| 306 | # ifdef __cpp_lib_atomic_wait |
| 307 | # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!" |
| 308 | # endif |
| 309 | # endif |
| 310 | |
| 311 | # if defined(__cpp_char8_t) |
| 312 | # ifndef __cpp_lib_char8_t |
| 313 | # error "__cpp_lib_char8_t should be defined in c++23" |
| 314 | # endif |
| 315 | # if __cpp_lib_char8_t != 201907L |
| 316 | # error "__cpp_lib_char8_t should have the value 201907L in c++23" |
| 317 | # endif |
| 318 | # else |
| 319 | # ifdef __cpp_lib_char8_t |
| 320 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 321 | # endif |
| 322 | # endif |
| 323 | |
| 324 | #elif TEST_STD_VER > 23 |
| 325 | |
| 326 | # ifndef __cpp_lib_atomic_flag_test |
| 327 | # error "__cpp_lib_atomic_flag_test should be defined in c++26" |
| 328 | # endif |
| 329 | # if __cpp_lib_atomic_flag_test != 201907L |
| 330 | # error "__cpp_lib_atomic_flag_test should have the value 201907L in c++26" |
| 331 | # endif |
| 332 | |
| 333 | # ifndef __cpp_lib_atomic_float |
| 334 | # error "__cpp_lib_atomic_float should be defined in c++26" |
| 335 | # endif |
| 336 | # if __cpp_lib_atomic_float != 201711L |
| 337 | # error "__cpp_lib_atomic_float should have the value 201711L in c++26" |
| 338 | # endif |
| 339 | |
| 340 | # ifndef __cpp_lib_atomic_is_always_lock_free |
| 341 | # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++26" |
| 342 | # endif |
| 343 | # if __cpp_lib_atomic_is_always_lock_free != 201603L |
| 344 | # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++26" |
| 345 | # endif |
| 346 | |
| 347 | # ifndef __cpp_lib_atomic_lock_free_type_aliases |
| 348 | # error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++26" |
| 349 | # endif |
| 350 | # if __cpp_lib_atomic_lock_free_type_aliases != 201907L |
| 351 | # error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++26" |
| 352 | # endif |
| 353 | |
| 354 | # if !defined(_LIBCPP_VERSION) |
| 355 | # ifndef __cpp_lib_atomic_min_max |
| 356 | # error "__cpp_lib_atomic_min_max should be defined in c++26" |
| 357 | # endif |
| 358 | # if __cpp_lib_atomic_min_max != 202403L |
| 359 | # error "__cpp_lib_atomic_min_max should have the value 202403L in c++26" |
| 360 | # endif |
| 361 | # else |
| 362 | # ifdef __cpp_lib_atomic_min_max |
| 363 | # error "__cpp_lib_atomic_min_max should not be defined because it is unimplemented in libc++!" |
| 364 | # endif |
| 365 | # endif |
| 366 | |
| 367 | # ifndef __cpp_lib_atomic_ref |
| 368 | # error "__cpp_lib_atomic_ref should be defined in c++26" |
| 369 | # endif |
| 370 | # if __cpp_lib_atomic_ref != 201806L |
| 371 | # error "__cpp_lib_atomic_ref should have the value 201806L in c++26" |
| 372 | # endif |
| 373 | |
| 374 | # if !defined(_LIBCPP_VERSION) |
| 375 | # ifndef __cpp_lib_atomic_shared_ptr |
| 376 | # error "__cpp_lib_atomic_shared_ptr should be defined in c++26" |
| 377 | # endif |
| 378 | # if __cpp_lib_atomic_shared_ptr != 201711L |
| 379 | # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++26" |
| 380 | # endif |
| 381 | # else |
| 382 | # ifdef __cpp_lib_atomic_shared_ptr |
| 383 | # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!" |
| 384 | # endif |
| 385 | # endif |
| 386 | |
| 387 | # ifndef __cpp_lib_atomic_value_initialization |
| 388 | # error "__cpp_lib_atomic_value_initialization should be defined in c++26" |
| 389 | # endif |
| 390 | # if __cpp_lib_atomic_value_initialization != 201911L |
| 391 | # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++26" |
| 392 | # endif |
| 393 | |
| 394 | # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC |
| 395 | # ifndef __cpp_lib_atomic_wait |
| 396 | # error "__cpp_lib_atomic_wait should be defined in c++26" |
| 397 | # endif |
| 398 | # if __cpp_lib_atomic_wait != 201907L |
| 399 | # error "__cpp_lib_atomic_wait should have the value 201907L in c++26" |
| 400 | # endif |
| 401 | # else |
| 402 | # ifdef __cpp_lib_atomic_wait |
| 403 | # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!" |
| 404 | # endif |
| 405 | # endif |
| 406 | |
| 407 | # if defined(__cpp_char8_t) |
| 408 | # ifndef __cpp_lib_char8_t |
| 409 | # error "__cpp_lib_char8_t should be defined in c++26" |
| 410 | # endif |
| 411 | # if __cpp_lib_char8_t != 201907L |
| 412 | # error "__cpp_lib_char8_t should have the value 201907L in c++26" |
| 413 | # endif |
| 414 | # else |
| 415 | # ifdef __cpp_lib_char8_t |
| 416 | # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" |
| 417 | # endif |
| 418 | # endif |
| 419 | |
| 420 | #endif // TEST_STD_VER > 23 |
| 421 | |
| 422 | // clang-format on |
| 423 | |
| 424 | |