Debian Codegraph @

libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp

raw
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 # ifndef __cpp_lib_atomic_ref
204 # error "__cpp_lib_atomic_ref should be defined in c++20"
205 # endif
206 # if __cpp_lib_atomic_ref != 201806L
207 # error "__cpp_lib_atomic_ref should have the value 201806L in c++20"
208 # endif
209
210 # if !defined(_LIBCPP_VERSION)
211 # ifndef __cpp_lib_atomic_shared_ptr
212 # error "__cpp_lib_atomic_shared_ptr should be defined in c++20"
213 # endif
214 # if __cpp_lib_atomic_shared_ptr != 201711L
215 # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++20"
216 # endif
217 # else // _LIBCPP_VERSION
218 # ifdef __cpp_lib_atomic_shared_ptr
219 # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
220 # endif
221 # endif
222
223 # ifndef __cpp_lib_atomic_value_initialization
224 # error "__cpp_lib_atomic_value_initialization should be defined in c++20"
225 # endif
226 # if __cpp_lib_atomic_value_initialization != 201911L
227 # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++20"
228 # endif
229
230 # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
231 # ifndef __cpp_lib_atomic_wait
232 # error "__cpp_lib_atomic_wait should be defined in c++20"
233 # endif
234 # if __cpp_lib_atomic_wait != 201907L
235 # error "__cpp_lib_atomic_wait should have the value 201907L in c++20"
236 # endif
237 # else
238 # ifdef __cpp_lib_atomic_wait
239 # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
240 # endif
241 # endif
242
243 # if defined(__cpp_char8_t)
244 # ifndef __cpp_lib_char8_t
245 # error "__cpp_lib_char8_t should be defined in c++20"
246 # endif
247 # if __cpp_lib_char8_t != 201907L
248 # error "__cpp_lib_char8_t should have the value 201907L in c++20"
249 # endif
250 # else
251 # ifdef __cpp_lib_char8_t
252 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
253 # endif
254 # endif
255
256 #elif TEST_STD_VER == 23
257
258 # ifndef __cpp_lib_atomic_flag_test
259 # error "__cpp_lib_atomic_flag_test should be defined in c++23"
260 # endif
261 # if __cpp_lib_atomic_flag_test != 201907L
262 # error "__cpp_lib_atomic_flag_test should have the value 201907L in c++23"
263 # endif
264
265 # if !defined(_LIBCPP_VERSION)
266 # ifndef __cpp_lib_atomic_float
267 # error "__cpp_lib_atomic_float should be defined in c++23"
268 # endif
269 # if __cpp_lib_atomic_float != 201711L
270 # error "__cpp_lib_atomic_float should have the value 201711L in c++23"
271 # endif
272 # else // _LIBCPP_VERSION
273 # ifdef __cpp_lib_atomic_float
274 # error "__cpp_lib_atomic_float should not be defined because it is unimplemented in libc++!"
275 # endif
276 # endif
277
278 # ifndef __cpp_lib_atomic_is_always_lock_free
279 # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++23"
280 # endif
281 # if __cpp_lib_atomic_is_always_lock_free != 201603L
282 # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++23"
283 # endif
284
285 # ifndef __cpp_lib_atomic_lock_free_type_aliases
286 # error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++23"
287 # endif
288 # if __cpp_lib_atomic_lock_free_type_aliases != 201907L
289 # error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++23"
290 # endif
291
292 # ifdef __cpp_lib_atomic_min_max
293 # error "__cpp_lib_atomic_min_max should not be defined before c++26"
294 # endif
295
296 # ifndef __cpp_lib_atomic_ref
297 # error "__cpp_lib_atomic_ref should be defined in c++23"
298 # endif
299 # if __cpp_lib_atomic_ref != 201806L
300 # error "__cpp_lib_atomic_ref should have the value 201806L in c++23"
301 # endif
302
303 # if !defined(_LIBCPP_VERSION)
304 # ifndef __cpp_lib_atomic_shared_ptr
305 # error "__cpp_lib_atomic_shared_ptr should be defined in c++23"
306 # endif
307 # if __cpp_lib_atomic_shared_ptr != 201711L
308 # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++23"
309 # endif
310 # else // _LIBCPP_VERSION
311 # ifdef __cpp_lib_atomic_shared_ptr
312 # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
313 # endif
314 # endif
315
316 # ifndef __cpp_lib_atomic_value_initialization
317 # error "__cpp_lib_atomic_value_initialization should be defined in c++23"
318 # endif
319 # if __cpp_lib_atomic_value_initialization != 201911L
320 # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++23"
321 # endif
322
323 # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
324 # ifndef __cpp_lib_atomic_wait
325 # error "__cpp_lib_atomic_wait should be defined in c++23"
326 # endif
327 # if __cpp_lib_atomic_wait != 201907L
328 # error "__cpp_lib_atomic_wait should have the value 201907L in c++23"
329 # endif
330 # else
331 # ifdef __cpp_lib_atomic_wait
332 # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
333 # endif
334 # endif
335
336 # if defined(__cpp_char8_t)
337 # ifndef __cpp_lib_char8_t
338 # error "__cpp_lib_char8_t should be defined in c++23"
339 # endif
340 # if __cpp_lib_char8_t != 201907L
341 # error "__cpp_lib_char8_t should have the value 201907L in c++23"
342 # endif
343 # else
344 # ifdef __cpp_lib_char8_t
345 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
346 # endif
347 # endif
348
349 #elif TEST_STD_VER > 23
350
351 # ifndef __cpp_lib_atomic_flag_test
352 # error "__cpp_lib_atomic_flag_test should be defined in c++26"
353 # endif
354 # if __cpp_lib_atomic_flag_test != 201907L
355 # error "__cpp_lib_atomic_flag_test should have the value 201907L in c++26"
356 # endif
357
358 # if !defined(_LIBCPP_VERSION)
359 # ifndef __cpp_lib_atomic_float
360 # error "__cpp_lib_atomic_float should be defined in c++26"
361 # endif
362 # if __cpp_lib_atomic_float != 201711L
363 # error "__cpp_lib_atomic_float should have the value 201711L in c++26"
364 # endif
365 # else // _LIBCPP_VERSION
366 # ifdef __cpp_lib_atomic_float
367 # error "__cpp_lib_atomic_float should not be defined because it is unimplemented in libc++!"
368 # endif
369 # endif
370
371 # ifndef __cpp_lib_atomic_is_always_lock_free
372 # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++26"
373 # endif
374 # if __cpp_lib_atomic_is_always_lock_free != 201603L
375 # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++26"
376 # endif
377
378 # ifndef __cpp_lib_atomic_lock_free_type_aliases
379 # error "__cpp_lib_atomic_lock_free_type_aliases should be defined in c++26"
380 # endif
381 # if __cpp_lib_atomic_lock_free_type_aliases != 201907L
382 # error "__cpp_lib_atomic_lock_free_type_aliases should have the value 201907L in c++26"
383 # endif
384
385 # if !defined(_LIBCPP_VERSION)
386 # ifndef __cpp_lib_atomic_min_max
387 # error "__cpp_lib_atomic_min_max should be defined in c++26"
388 # endif
389 # if __cpp_lib_atomic_min_max != 202403L
390 # error "__cpp_lib_atomic_min_max should have the value 202403L in c++26"
391 # endif
392 # else // _LIBCPP_VERSION
393 # ifdef __cpp_lib_atomic_min_max
394 # error "__cpp_lib_atomic_min_max should not be defined because it is unimplemented in libc++!"
395 # endif
396 # endif
397
398 # ifndef __cpp_lib_atomic_ref
399 # error "__cpp_lib_atomic_ref should be defined in c++26"
400 # endif
401 # if __cpp_lib_atomic_ref != 201806L
402 # error "__cpp_lib_atomic_ref should have the value 201806L in c++26"
403 # endif
404
405 # if !defined(_LIBCPP_VERSION)
406 # ifndef __cpp_lib_atomic_shared_ptr
407 # error "__cpp_lib_atomic_shared_ptr should be defined in c++26"
408 # endif
409 # if __cpp_lib_atomic_shared_ptr != 201711L
410 # error "__cpp_lib_atomic_shared_ptr should have the value 201711L in c++26"
411 # endif
412 # else // _LIBCPP_VERSION
413 # ifdef __cpp_lib_atomic_shared_ptr
414 # error "__cpp_lib_atomic_shared_ptr should not be defined because it is unimplemented in libc++!"
415 # endif
416 # endif
417
418 # ifndef __cpp_lib_atomic_value_initialization
419 # error "__cpp_lib_atomic_value_initialization should be defined in c++26"
420 # endif
421 # if __cpp_lib_atomic_value_initialization != 201911L
422 # error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++26"
423 # endif
424
425 # if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
426 # ifndef __cpp_lib_atomic_wait
427 # error "__cpp_lib_atomic_wait should be defined in c++26"
428 # endif
429 # if __cpp_lib_atomic_wait != 201907L
430 # error "__cpp_lib_atomic_wait should have the value 201907L in c++26"
431 # endif
432 # else
433 # ifdef __cpp_lib_atomic_wait
434 # error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
435 # endif
436 # endif
437
438 # if defined(__cpp_char8_t)
439 # ifndef __cpp_lib_char8_t
440 # error "__cpp_lib_char8_t should be defined in c++26"
441 # endif
442 # if __cpp_lib_char8_t != 201907L
443 # error "__cpp_lib_char8_t should have the value 201907L in c++26"
444 # endif
445 # else
446 # ifdef __cpp_lib_char8_t
447 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"
448 # endif
449 # endif
450
451 #endif // TEST_STD_VER > 23
452