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