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