Skip to content

Commit 056a331

Browse files
committed
feature test macro
1 parent 9f18aa9 commit 056a331

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
@@ -1116,6 +1124,14 @@
11161124
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
11171125
# endif
11181126

1127+
# ifdef __cpp_lib_constexpr_flat_map
1128+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
1129+
# endif
1130+
1131+
# ifdef __cpp_lib_constexpr_flat_set
1132+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
1133+
# endif
1134+
11191135
# ifdef __cpp_lib_constexpr_forward_list
11201136
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
11211137
# endif
@@ -2130,6 +2146,14 @@
21302146
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
21312147
# endif
21322148

2149+
# ifdef __cpp_lib_constexpr_flat_map
2150+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
2151+
# endif
2152+
2153+
# ifdef __cpp_lib_constexpr_flat_set
2154+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
2155+
# endif
2156+
21332157
# ifdef __cpp_lib_constexpr_forward_list
21342158
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
21352159
# endif
@@ -3384,6 +3408,14 @@
33843408
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20"
33853409
# endif
33863410

3411+
# ifdef __cpp_lib_constexpr_flat_map
3412+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
3413+
# endif
3414+
3415+
# ifdef __cpp_lib_constexpr_flat_set
3416+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
3417+
# endif
3418+
33873419
# ifdef __cpp_lib_constexpr_forward_list
33883420
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
33893421
# endif
@@ -4860,6 +4892,14 @@
48604892
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++23"
48614893
# endif
48624894

4895+
# ifdef __cpp_lib_constexpr_flat_map
4896+
# error "__cpp_lib_constexpr_flat_map should not be defined before c++26"
4897+
# endif
4898+
4899+
# ifdef __cpp_lib_constexpr_flat_set
4900+
# error "__cpp_lib_constexpr_flat_set should not be defined before c++26"
4901+
# endif
4902+
48634903
# ifdef __cpp_lib_constexpr_forward_list
48644904
# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
48654905
# endif
@@ -6549,6 +6589,20 @@
65496589
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++26"
65506590
# endif
65516591

6592+
# ifndef __cpp_lib_constexpr_flat_map
6593+
# error "__cpp_lib_constexpr_flat_map should be defined in c++26"
6594+
# endif
6595+
# if __cpp_lib_constexpr_flat_map != 202502L
6596+
# error "__cpp_lib_constexpr_flat_map should have the value 202502L in c++26"
6597+
# endif
6598+
6599+
# ifndef __cpp_lib_constexpr_flat_set
6600+
# error "__cpp_lib_constexpr_flat_set should be defined in c++26"
6601+
# endif
6602+
# if __cpp_lib_constexpr_flat_set != 202502L
6603+
# error "__cpp_lib_constexpr_flat_set should have the value 202502L in c++26"
6604+
# endif
6605+
65526606
# ifndef __cpp_lib_constexpr_forward_list
65536607
# error "__cpp_lib_constexpr_forward_list should be defined in c++26"
65546608
# endif

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ def add_version_header(tc):
365365
"values": {"c++20": 201907},
366366
"headers": ["memory"],
367367
},
368+
{
369+
"name": "__cpp_lib_constexpr_flat_map",
370+
"values": {"c++26": 202502},
371+
"headers": ["flat_map"],
372+
},
373+
{
374+
"name": "__cpp_lib_constexpr_flat_set",
375+
"values": {"c++26": 202502},
376+
"headers": ["flat_set"],
377+
},
368378
{
369379
"name": "__cpp_lib_constexpr_forward_list",
370380
"values": {"c++26": 202502},

0 commit comments

Comments
 (0)