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 | // UNSUPPORTED: no-threads |
15 | |
16 | // <mutex> |
17 | |
18 | // Test the feature test macros defined by <mutex> |
19 | |
20 | /* Constant Value |
21 | __cpp_lib_scoped_lock 201703L [C++17] |
22 | */ |
23 | |
24 | #include <mutex> |
25 | #include "test_macros.h" |
26 | |
27 | #if TEST_STD_VER < 14 |
28 | |
29 | # ifdef __cpp_lib_scoped_lock |
30 | # error "__cpp_lib_scoped_lock should not be defined before c++17" |
31 | # endif |
32 | |
33 | #elif TEST_STD_VER == 14 |
34 | |
35 | # ifdef __cpp_lib_scoped_lock |
36 | # error "__cpp_lib_scoped_lock should not be defined before c++17" |
37 | # endif |
38 | |
39 | #elif TEST_STD_VER == 17 |
40 | |
41 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
42 | # ifndef __cpp_lib_scoped_lock |
43 | # error "__cpp_lib_scoped_lock should be defined in c++17" |
44 | # endif |
45 | # if __cpp_lib_scoped_lock != 201703L |
46 | # error "__cpp_lib_scoped_lock should have the value 201703L in c++17" |
47 | # endif |
48 | # else |
49 | # ifdef __cpp_lib_scoped_lock |
50 | # error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!" |
51 | # endif |
52 | # endif |
53 | |
54 | #elif TEST_STD_VER == 20 |
55 | |
56 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
57 | # ifndef __cpp_lib_scoped_lock |
58 | # error "__cpp_lib_scoped_lock should be defined in c++20" |
59 | # endif |
60 | # if __cpp_lib_scoped_lock != 201703L |
61 | # error "__cpp_lib_scoped_lock should have the value 201703L in c++20" |
62 | # endif |
63 | # else |
64 | # ifdef __cpp_lib_scoped_lock |
65 | # error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!" |
66 | # endif |
67 | # endif |
68 | |
69 | #elif TEST_STD_VER == 23 |
70 | |
71 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
72 | # ifndef __cpp_lib_scoped_lock |
73 | # error "__cpp_lib_scoped_lock should be defined in c++23" |
74 | # endif |
75 | # if __cpp_lib_scoped_lock != 201703L |
76 | # error "__cpp_lib_scoped_lock should have the value 201703L in c++23" |
77 | # endif |
78 | # else |
79 | # ifdef __cpp_lib_scoped_lock |
80 | # error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!" |
81 | # endif |
82 | # endif |
83 | |
84 | #elif TEST_STD_VER > 23 |
85 | |
86 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
87 | # ifndef __cpp_lib_scoped_lock |
88 | # error "__cpp_lib_scoped_lock should be defined in c++26" |
89 | # endif |
90 | # if __cpp_lib_scoped_lock != 201703L |
91 | # error "__cpp_lib_scoped_lock should have the value 201703L in c++26" |
92 | # endif |
93 | # else |
94 | # ifdef __cpp_lib_scoped_lock |
95 | # error "__cpp_lib_scoped_lock should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!" |
96 | # endif |
97 | # endif |
98 | |
99 | #endif // TEST_STD_VER > 23 |
100 | |
101 | |