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 // <atomic>
15 
16 // Test the feature test macros defined by <atomic>
17 
18 /*  Constant                                   Value
19     __cpp_lib_atomic_flag_test                 201907L [C++20]
20     __cpp_lib_atomic_float                     201711L [C++20]
21     __cpp_lib_atomic_is_always_lock_free       201603L [C++17]
22     __cpp_lib_atomic_lock_free_type_aliases    201907L [C++20]
23     __cpp_lib_atomic_ref                       201806L [C++20]
24     __cpp_lib_atomic_shared_ptr                201711L [C++20]
25     __cpp_lib_atomic_value_initialization      201911L [C++20]
26     __cpp_lib_atomic_wait                      201907L [C++20]
27     __cpp_lib_char8_t                          201907L [C++20]
28 */
29 
30 #include <atomic>
31 #include "test_macros.h"
32 
33 #if TEST_STD_VER < 14
34 
35 # ifdef __cpp_lib_atomic_flag_test
36 #   error "__cpp_lib_atomic_flag_test should not be defined before c++20"
37 # endif
38 
39 # ifdef __cpp_lib_atomic_float
40 #   error "__cpp_lib_atomic_float should not be defined before c++20"
41 # endif
42 
43 # ifdef __cpp_lib_atomic_is_always_lock_free
44 #   error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
45 # endif
46 
47 # ifdef __cpp_lib_atomic_lock_free_type_aliases
48 #   error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20"
49 # endif
50 
51 # ifdef __cpp_lib_atomic_ref
52 #   error "__cpp_lib_atomic_ref should not be defined before c++20"
53 # endif
54 
55 # ifdef __cpp_lib_atomic_shared_ptr
56 #   error "__cpp_lib_atomic_shared_ptr should not be defined before c++20"
57 # endif
58 
59 # ifdef __cpp_lib_atomic_value_initialization
60 #   error "__cpp_lib_atomic_value_initialization should not be defined before c++20"
61 # endif
62 
63 # ifdef __cpp_lib_atomic_wait
64 #   error "__cpp_lib_atomic_wait should not be defined before c++20"
65 # endif
66 
67 # ifdef __cpp_lib_char8_t
68 #   error "__cpp_lib_char8_t should not be defined before c++20"
69 # endif
70 
71 #elif TEST_STD_VER == 14
72 
73 # ifdef __cpp_lib_atomic_flag_test
74 #   error "__cpp_lib_atomic_flag_test should not be defined before c++20"
75 # endif
76 
77 # ifdef __cpp_lib_atomic_float
78 #   error "__cpp_lib_atomic_float should not be defined before c++20"
79 # endif
80 
81 # ifdef __cpp_lib_atomic_is_always_lock_free
82 #   error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
83 # endif
84 
85 # ifdef __cpp_lib_atomic_lock_free_type_aliases
86 #   error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20"
87 # endif
88 
89 # ifdef __cpp_lib_atomic_ref
90 #   error "__cpp_lib_atomic_ref should not be defined before c++20"
91 # endif
92 
93 # ifdef __cpp_lib_atomic_shared_ptr
94 #   error "__cpp_lib_atomic_shared_ptr should not be defined before c++20"
95 # endif
96 
97 # ifdef __cpp_lib_atomic_value_initialization
98 #   error "__cpp_lib_atomic_value_initialization should not be defined before c++20"
99 # endif
100 
101 # ifdef __cpp_lib_atomic_wait
102 #   error "__cpp_lib_atomic_wait should not be defined before c++20"
103 # endif
104 
105 # ifdef __cpp_lib_char8_t
106 #   error "__cpp_lib_char8_t should not be defined before c++20"
107 # endif
108 
109 #elif TEST_STD_VER == 17
110 
111 # ifdef __cpp_lib_atomic_flag_test
112 #   error "__cpp_lib_atomic_flag_test should not be defined before c++20"
113 # endif
114 
115 # ifdef __cpp_lib_atomic_float
116 #   error "__cpp_lib_atomic_float should not be defined before c++20"
117 # endif
118 
119 # ifndef __cpp_lib_atomic_is_always_lock_free
120 #   error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
121 # endif
122 # if __cpp_lib_atomic_is_always_lock_free != 201603L
123 #   error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
124 # endif
125 
126 # ifdef __cpp_lib_atomic_lock_free_type_aliases
127 #   error "__cpp_lib_atomic_lock_free_type_aliases should not be defined before c++20"
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 # if !defined(_LIBCPP_VERSION)
160 #   ifndef __cpp_lib_atomic_float
161 #     error "__cpp_lib_atomic_float should be defined in c++20"
162 #   endif
163 #   if __cpp_lib_atomic_float != 201711L
164 #     error "__cpp_lib_atomic_float should have the value 201711L in c++20"
165 #   endif
166 # else // _LIBCPP_VERSION
167 #   ifdef __cpp_lib_atomic_float
168 #     error "__cpp_lib_atomic_float should not be defined because it is unimplemented in libc++!"
169 #   endif
170 # endif
171 
172 # ifndef __cpp_lib_atomic_is_always_lock_free
173 #   error "__cpp_lib_atomic_is_always_lock_free should be defined in c++20"
174 # endif
175 # if __cpp_lib_atomic_is_always_lock_free != 201603L
176 #   error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++20"
177 # endif
178 
179 # ifndef __cpp_lib_atomic_lock_free_type_aliases
180 #   error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++20"
181 # endif
182 # if __cpp_lib_atomic_lock_free_type_aliases != 201907L
183 #   error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++20"
184 # endif
185 
186 # if !defined(_LIBCPP_VERSION)
187 #   ifndef __cpp_lib_atomic_ref
188 #     error "__cpp_lib_atomic_ref should be defined in c++20"
189 #   endif
190 #   if __cpp_lib_atomic_ref != 201806L
191 #     error "__cpp_lib_atomic_ref should have the value 201806L in c++20"
192 #   endif
193 # else // _LIBCPP_VERSION
194 #   ifdef __cpp_lib_atomic_ref
195 #     error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
196 #   endif
197 # endif
198 
199 # if !defined(_LIBCPP_VERSION)
200 #   ifndef __cpp_lib_atomic_shared_ptr
201 #     error "__cpp_lib_atomic_shared_ptr should be defined in c++20"
202 #   endif
203 #   if __cpp_lib_atomic_shared_ptr != 201711L
204 #     error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++20"
205 #   endif
206 # else // _LIBCPP_VERSION
207 #   ifdef __cpp_lib_atomic_shared_ptr
208 #     error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
209 #   endif
210 # endif
211 
212 # ifndef __cpp_lib_atomic_value_initialization
213 #   error "__cpp_lib_atomic_value_initialization should be defined in c++20"
214 # endif
215 # if __cpp_lib_atomic_value_initialization != 201911L
216 #   error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++20"
217 # endif
218 
219 # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
220 #   ifndef __cpp_lib_atomic_wait
221 #     error "__cpp_lib_atomic_wait should be defined in c++20"
222 #   endif
223 #   if __cpp_lib_atomic_wait != 201907L
224 #     error "__cpp_lib_atomic_wait should have the value 201907L in c++20"
225 #   endif
226 # else
227 #   ifdef __cpp_lib_atomic_wait
228 #     error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
229 #   endif
230 # endif
231 
232 # if defined(__cpp_char8_t)
233 #   ifndef __cpp_lib_char8_t
234 #     error "__cpp_lib_char8_t should be defined in c++20"
235 #   endif
236 #   if __cpp_lib_char8_t != 201907L
237 #     error "__cpp_lib_char8_t should have the value 201907L in c++20"
238 #   endif
239 # else
240 #   ifdef __cpp_lib_char8_t
241 #     error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
242 #   endif
243 # endif
244 
245 #elif TEST_STD_VER > 20
246 
247 # ifndef __cpp_lib_atomic_flag_test
248 #   error "__cpp_lib_atomic_flag_test should be defined in c++2b"
249 # endif
250 # if __cpp_lib_atomic_flag_test != 201907L
251 #   error "__cpp_lib_atomic_flag_test should have the value 201907L in c++2b"
252 # endif
253 
254 # if !defined(_LIBCPP_VERSION)
255 #   ifndef __cpp_lib_atomic_float
256 #     error "__cpp_lib_atomic_float should be defined in c++2b"
257 #   endif
258 #   if __cpp_lib_atomic_float != 201711L
259 #     error "__cpp_lib_atomic_float should have the value 201711L in c++2b"
260 #   endif
261 # else // _LIBCPP_VERSION
262 #   ifdef __cpp_lib_atomic_float
263 #     error "__cpp_lib_atomic_float should not be defined because it is unimplemented in libc++!"
264 #   endif
265 # endif
266 
267 # ifndef __cpp_lib_atomic_is_always_lock_free
268 #   error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2b"
269 # endif
270 # if __cpp_lib_atomic_is_always_lock_free != 201603L
271 #   error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2b"
272 # endif
273 
274 # ifndef __cpp_lib_atomic_lock_free_type_aliases
275 #   error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++2b"
276 # endif
277 # if __cpp_lib_atomic_lock_free_type_aliases != 201907L
278 #   error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++2b"
279 # endif
280 
281 # if !defined(_LIBCPP_VERSION)
282 #   ifndef __cpp_lib_atomic_ref
283 #     error "__cpp_lib_atomic_ref should be defined in c++2b"
284 #   endif
285 #   if __cpp_lib_atomic_ref != 201806L
286 #     error "__cpp_lib_atomic_ref should have the value 201806L in c++2b"
287 #   endif
288 # else // _LIBCPP_VERSION
289 #   ifdef __cpp_lib_atomic_ref
290 #     error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
291 #   endif
292 # endif
293 
294 # if !defined(_LIBCPP_VERSION)
295 #   ifndef __cpp_lib_atomic_shared_ptr
296 #     error "__cpp_lib_atomic_shared_ptr should be defined in c++2b"
297 #   endif
298 #   if __cpp_lib_atomic_shared_ptr != 201711L
299 #     error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++2b"
300 #   endif
301 # else // _LIBCPP_VERSION
302 #   ifdef __cpp_lib_atomic_shared_ptr
303 #     error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
304 #   endif
305 # endif
306 
307 # ifndef __cpp_lib_atomic_value_initialization
308 #   error "__cpp_lib_atomic_value_initialization should be defined in c++2b"
309 # endif
310 # if __cpp_lib_atomic_value_initialization != 201911L
311 #   error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++2b"
312 # endif
313 
314 # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)
315 #   ifndef __cpp_lib_atomic_wait
316 #     error "__cpp_lib_atomic_wait should be defined in c++2b"
317 #   endif
318 #   if __cpp_lib_atomic_wait != 201907L
319 #     error "__cpp_lib_atomic_wait should have the value 201907L in c++2b"
320 #   endif
321 # else
322 #   ifdef __cpp_lib_atomic_wait
323 #     error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!"
324 #   endif
325 # endif
326 
327 # if defined(__cpp_char8_t)
328 #   ifndef __cpp_lib_char8_t
329 #     error "__cpp_lib_char8_t should be defined in c++2b"
330 #   endif
331 #   if __cpp_lib_char8_t != 201907L
332 #     error "__cpp_lib_char8_t should have the value 201907L in c++2b"
333 #   endif
334 # else
335 #   ifdef __cpp_lib_char8_t
336 #     error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
337 #   endif
338 # endif
339 
340 #endif // TEST_STD_VER > 20
341 
342