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 // <shared_mutex>
17 
18 // Test the feature test macros defined by <shared_mutex>
19 
20 /*  Constant                        Value
21     __cpp_lib_shared_mutex          201505L [C++17]
22     __cpp_lib_shared_timed_mutex    201402L [C++14]
23 */
24 
25 #include <shared_mutex>
26 #include "test_macros.h"
27 
28 #if TEST_STD_VER < 14
29 
30 # ifdef __cpp_lib_shared_mutex
31 #   error "__cpp_lib_shared_mutex should not be defined before c++17"
32 # endif
33 
34 # ifdef __cpp_lib_shared_timed_mutex
35 #   error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
36 # endif
37 
38 #elif TEST_STD_VER == 14
39 
40 # ifdef __cpp_lib_shared_mutex
41 #   error "__cpp_lib_shared_mutex should not be defined before c++17"
42 # endif
43 
44 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
45 #   ifndef __cpp_lib_shared_timed_mutex
46 #     error "__cpp_lib_shared_timed_mutex should be defined in c++14"
47 #   endif
48 #   if __cpp_lib_shared_timed_mutex != 201402L
49 #     error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
50 #   endif
51 # else
52 #   ifdef __cpp_lib_shared_timed_mutex
53 #     error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
54 #   endif
55 # endif
56 
57 #elif TEST_STD_VER == 17
58 
59 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
60 #   ifndef __cpp_lib_shared_mutex
61 #     error "__cpp_lib_shared_mutex should be defined in c++17"
62 #   endif
63 #   if __cpp_lib_shared_mutex != 201505L
64 #     error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
65 #   endif
66 # else
67 #   ifdef __cpp_lib_shared_mutex
68 #     error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
69 #   endif
70 # endif
71 
72 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
73 #   ifndef __cpp_lib_shared_timed_mutex
74 #     error "__cpp_lib_shared_timed_mutex should be defined in c++17"
75 #   endif
76 #   if __cpp_lib_shared_timed_mutex != 201402L
77 #     error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
78 #   endif
79 # else
80 #   ifdef __cpp_lib_shared_timed_mutex
81 #     error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
82 #   endif
83 # endif
84 
85 #elif TEST_STD_VER == 20
86 
87 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
88 #   ifndef __cpp_lib_shared_mutex
89 #     error "__cpp_lib_shared_mutex should be defined in c++20"
90 #   endif
91 #   if __cpp_lib_shared_mutex != 201505L
92 #     error "__cpp_lib_shared_mutex should have the value 201505L in c++20"
93 #   endif
94 # else
95 #   ifdef __cpp_lib_shared_mutex
96 #     error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
97 #   endif
98 # endif
99 
100 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
101 #   ifndef __cpp_lib_shared_timed_mutex
102 #     error "__cpp_lib_shared_timed_mutex should be defined in c++20"
103 #   endif
104 #   if __cpp_lib_shared_timed_mutex != 201402L
105 #     error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++20"
106 #   endif
107 # else
108 #   ifdef __cpp_lib_shared_timed_mutex
109 #     error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
110 #   endif
111 # endif
112 
113 #elif TEST_STD_VER > 20
114 
115 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)
116 #   ifndef __cpp_lib_shared_mutex
117 #     error "__cpp_lib_shared_mutex should be defined in c++2b"
118 #   endif
119 #   if __cpp_lib_shared_mutex != 201505L
120 #     error "__cpp_lib_shared_mutex should have the value 201505L in c++2b"
121 #   endif
122 # else
123 #   ifdef __cpp_lib_shared_mutex
124 #     error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!"
125 #   endif
126 # endif
127 
128 # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)
129 #   ifndef __cpp_lib_shared_timed_mutex
130 #     error "__cpp_lib_shared_timed_mutex should be defined in c++2b"
131 #   endif
132 #   if __cpp_lib_shared_timed_mutex != 201402L
133 #     error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2b"
134 #   endif
135 # else
136 #   ifdef __cpp_lib_shared_timed_mutex
137 #     error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!"
138 #   endif
139 # endif
140 
141 #endif // TEST_STD_VER > 20
142 
143