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