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 | // UNSUPPORTED: no-threads |
13 | |
14 | // <barrier> |
15 | |
16 | // Test the feature test macros defined by <barrier> |
17 | |
18 | // clang-format off |
19 | |
20 | #include <barrier> |
21 | #include "test_macros.h" |
22 | |
23 | #if TEST_STD_VER < 14 |
24 | |
25 | # ifdef __cpp_lib_barrier |
26 | # error "__cpp_lib_barrier should not be defined before c++20" |
27 | # endif |
28 | |
29 | #elif TEST_STD_VER == 14 |
30 | |
31 | # ifdef __cpp_lib_barrier |
32 | # error "__cpp_lib_barrier should not be defined before c++20" |
33 | # endif |
34 | |
35 | #elif TEST_STD_VER == 17 |
36 | |
37 | # ifdef __cpp_lib_barrier |
38 | # error "__cpp_lib_barrier should not be defined before c++20" |
39 | # endif |
40 | |
41 | #elif TEST_STD_VER == 20 |
42 | |
43 | # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC) |
44 | # ifndef __cpp_lib_barrier |
45 | # error "__cpp_lib_barrier should be defined in c++20" |
46 | # endif |
47 | # if __cpp_lib_barrier != 201907L |
48 | # error "__cpp_lib_barrier should have the value 201907L in c++20" |
49 | # endif |
50 | # else |
51 | # ifdef __cpp_lib_barrier |
52 | # error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" |
53 | # endif |
54 | # endif |
55 | |
56 | #elif TEST_STD_VER == 23 |
57 | |
58 | # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC) |
59 | # ifndef __cpp_lib_barrier |
60 | # error "__cpp_lib_barrier should be defined in c++23" |
61 | # endif |
62 | # if __cpp_lib_barrier != 201907L |
63 | # error "__cpp_lib_barrier should have the value 201907L in c++23" |
64 | # endif |
65 | # else |
66 | # ifdef __cpp_lib_barrier |
67 | # error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" |
68 | # endif |
69 | # endif |
70 | |
71 | #elif TEST_STD_VER > 23 |
72 | |
73 | # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC) |
74 | # ifndef __cpp_lib_barrier |
75 | # error "__cpp_lib_barrier should be defined in c++26" |
76 | # endif |
77 | # if __cpp_lib_barrier != 201907L |
78 | # error "__cpp_lib_barrier should have the value 201907L in c++26" |
79 | # endif |
80 | # else |
81 | # ifdef __cpp_lib_barrier |
82 | # error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!" |
83 | # endif |
84 | # endif |
85 | |
86 | #endif // TEST_STD_VER > 23 |
87 | |
88 | // clang-format on |
89 | |
90 | |