Skip to content

Commit 23fe5ca

Browse files
committed
feature test macro
1 parent 3298c28 commit 23fe5ca

File tree

6 files changed

+126
-0
lines changed

6 files changed

+126
-0
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ Status
424424
---------------------------------------------------------- -----------------
425425
``__cpp_lib_constexpr_algorithms`` ``202306L``
426426
---------------------------------------------------------- -----------------
427+
``__cpp_lib_constexpr_flat_map`` ``202502L``
428+
---------------------------------------------------------- -----------------
429+
``__cpp_lib_constexpr_flat_set`` ``202502L``
430+
---------------------------------------------------------- -----------------
427431
``__cpp_lib_constexpr_forward_list`` ``202502L``
428432
---------------------------------------------------------- -----------------
429433
``__cpp_lib_constexpr_list`` ``202502L``

libcxx/include/version

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ __cpp_lib_constexpr_charconv 202207L <charconv>
7070
__cpp_lib_constexpr_cmath 202202L <cmath> <cstdlib>
7171
__cpp_lib_constexpr_complex 201711L <complex>
7272
__cpp_lib_constexpr_dynamic_alloc 201907L <memory>
73+
__cpp_lib_constexpr_flat_map 202502L <flat_map>
74+
__cpp_lib_constexpr_flat_set 202502L <flat_set>
7375
__cpp_lib_constexpr_forward_list 202502L <forward_list>
7476
__cpp_lib_constexpr_functional 201907L <functional>
7577
__cpp_lib_constexpr_iterator 201811L <iterator>
@@ -549,6 +551,8 @@ __cpp_lib_void_t 201411L <type_traits>
549551
# define __cpp_lib_bitset 202306L
550552
# undef __cpp_lib_constexpr_algorithms
551553
# define __cpp_lib_constexpr_algorithms 202306L
554+
# define __cpp_lib_constexpr_flat_map 202502L
555+
# define __cpp_lib_constexpr_flat_set 202502L
552556
# define __cpp_lib_constexpr_forward_list 202502L
553557
# define __cpp_lib_constexpr_list 202502L
554558
# if !defined(_LIBCPP_ABI_VCRUNTIME)

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,50 @@
2020

2121
#if TEST_STD_VER < 14
2222

23+
# ifdef __cpp_lib_constexpr_flat_map
24+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
25+
# endif
26+
2327
# ifdef __cpp_lib_flat_map
2428
# error "__cpp_lib_flat_map should not be defined before c++23"
2529
# endif
2630

2731
#elif TEST_STD_VER == 14
2832

33+
# ifdef __cpp_lib_constexpr_flat_map
34+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
35+
# endif
36+
2937
# ifdef __cpp_lib_flat_map
3038
# error "__cpp_lib_flat_map should not be defined before c++23"
3139
# endif
3240

3341
#elif TEST_STD_VER == 17
3442

43+
# ifdef __cpp_lib_constexpr_flat_map
44+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
45+
# endif
46+
3547
# ifdef __cpp_lib_flat_map
3648
# error "__cpp_lib_flat_map should not be defined before c++23"
3749
# endif
3850

3951
#elif TEST_STD_VER == 20
4052

53+
# ifdef __cpp_lib_constexpr_flat_map
54+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
55+
# endif
56+
4157
# ifdef __cpp_lib_flat_map
4258
# error "__cpp_lib_flat_map should not be defined before c++23"
4359
# endif
4460

4561
#elif TEST_STD_VER == 23
4662

63+
# ifdef __cpp_lib_constexpr_flat_map
64+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
65+
# endif
66+
4767
# ifndef __cpp_lib_flat_map
4868
# error "__cpp_lib_flat_map should be defined in c++23"
4969
# endif
@@ -53,6 +73,13 @@
5373

5474
#elif TEST_STD_VER > 23
5575

76+
# ifndef __cpp_lib_constexpr_flat_map
77+
# error "__cpp_lib_constexpr_flat_map should be defined in c++26"
78+
# endif
79+
# if __cpp_lib_constexpr_flat_map != 202502L
80+
# error "__cpp_lib_constexpr_flat_map should have the value 202502L in c++26"
81+
# endif
82+
5683
# ifndef __cpp_lib_flat_map
5784
# error "__cpp_lib_flat_map should be defined in c++26"
5885
# endif

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,50 @@
2020

2121
#if TEST_STD_VER < 14
2222

23+
# ifdef __cpp_lib_constexpr_flat_set
24+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
25+
# endif
26+
2327
# ifdef __cpp_lib_flat_set
2428
# error "__cpp_lib_flat_set should not be defined before c++23"
2529
# endif
2630

2731
#elif TEST_STD_VER == 14
2832

33+
# ifdef __cpp_lib_constexpr_flat_set
34+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
35+
# endif
36+
2937
# ifdef __cpp_lib_flat_set
3038
# error "__cpp_lib_flat_set should not be defined before c++23"
3139
# endif
3240

3341
#elif TEST_STD_VER == 17
3442

43+
# ifdef __cpp_lib_constexpr_flat_set
44+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
45+
# endif
46+
3547
# ifdef __cpp_lib_flat_set
3648
# error "__cpp_lib_flat_set should not be defined before c++23"
3749
# endif
3850

3951
#elif TEST_STD_VER == 20
4052

53+
# ifdef __cpp_lib_constexpr_flat_set
54+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
55+
# endif
56+
4157
# ifdef __cpp_lib_flat_set
4258
# error "__cpp_lib_flat_set should not be defined before c++23"
4359
# endif
4460

4561
#elif TEST_STD_VER == 23
4662

63+
# ifdef __cpp_lib_constexpr_flat_set
64+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
65+
# endif
66+
4767
# ifndef __cpp_lib_flat_set
4868
# error "__cpp_lib_flat_set should be defined in c++23"
4969
# endif
@@ -53,6 +73,13 @@
5373

5474
#elif TEST_STD_VER > 23
5575

76+
# ifndef __cpp_lib_constexpr_flat_set
77+
# error "__cpp_lib_constexpr_flat_set should be defined in c++26"
78+
# endif
79+
# if __cpp_lib_constexpr_flat_set != 202502L
80+
# error "__cpp_lib_constexpr_flat_set should have the value 202502L in c++26"
81+
# endif
82+
5683
# ifndef __cpp_lib_flat_set
5784
# error "__cpp_lib_flat_set should be defined in c++26"
5885
# endif

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@
204204
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
205205
# endif
206206

207+
# ifdef __cpp_lib_constexpr_flat_map
208+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
209+
# endif
210+
211+
# ifdef __cpp_lib_constexpr_flat_set
212+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
213+
# endif
214+
207215
# ifdef __cpp_lib_constexpr_forward_list
208216
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
209217
# endif
@@ -1108,6 +1116,14 @@
11081116
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
11091117
# endif
11101118

1119+
# ifdef __cpp_lib_constexpr_flat_map
1120+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
1121+
# endif
1122+
1123+
# ifdef __cpp_lib_constexpr_flat_set
1124+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
1125+
# endif
1126+
11111127
# ifdef __cpp_lib_constexpr_forward_list
11121128
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
11131129
# endif
@@ -2114,6 +2130,14 @@
21142130
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
21152131
# endif
21162132

2133+
# ifdef __cpp_lib_constexpr_flat_map
2134+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
2135+
# endif
2136+
2137+
# ifdef __cpp_lib_constexpr_flat_set
2138+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
2139+
# endif
2140+
21172141
# ifdef __cpp_lib_constexpr_forward_list
21182142
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
21192143
# endif
@@ -3366,6 +3390,14 @@
33663390
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20"
33673391
# endif
33683392

3393+
# ifdef __cpp_lib_constexpr_flat_map
3394+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
3395+
# endif
3396+
3397+
# ifdef __cpp_lib_constexpr_flat_set
3398+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
3399+
# endif
3400+
33693401
# ifdef __cpp_lib_constexpr_forward_list
33703402
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
33713403
# endif
@@ -4840,6 +4872,14 @@
48404872
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++23"
48414873
# endif
48424874

4875+
# ifdef __cpp_lib_constexpr_flat_map
4876+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
4877+
# endif
4878+
4879+
# ifdef __cpp_lib_constexpr_flat_set
4880+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
4881+
# endif
4882+
48434883
# ifdef __cpp_lib_constexpr_forward_list
48444884
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
48454885
# endif
@@ -6527,6 +6567,20 @@
65276567
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++26"
65286568
# endif
65296569

6570+
# ifndef __cpp_lib_constexpr_flat_map
6571+
# error "__cpp_lib_constexpr_flat_map should be defined in c++26"
6572+
# endif
6573+
# if __cpp_lib_constexpr_flat_map != 202502L
6574+
# error "__cpp_lib_constexpr_flat_map should have the value 202502L in c++26"
6575+
# endif
6576+
6577+
# ifndef __cpp_lib_constexpr_flat_set
6578+
# error "__cpp_lib_constexpr_flat_set should be defined in c++26"
6579+
# endif
6580+
# if __cpp_lib_constexpr_flat_set != 202502L
6581+
# error "__cpp_lib_constexpr_flat_set should have the value 202502L in c++26"
6582+
# endif
6583+
65306584
# ifndef __cpp_lib_constexpr_forward_list
65316585
# error "__cpp_lib_constexpr_forward_list should be defined in c++26"
65326586
# endif

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ def add_version_header(tc):
367367
"values": {"c++20": 201907},
368368
"headers": ["memory"],
369369
},
370+
{
371+
"name": "__cpp_lib_constexpr_flat_map",
372+
"values": {"c++26": 202502},
373+
"headers": ["flat_map"],
374+
},
375+
{
376+
"name": "__cpp_lib_constexpr_flat_set",
377+
"values": {"c++26": 202502},
378+
"headers": ["flat_set"],
379+
},
370380
{
371381
"name": "__cpp_lib_constexpr_forward_list",
372382
"values": {"c++26": 202502},

0 commit comments

Comments
 (0)