Skip to content

Commit 9c18f03

Browse files
authored
[libc++] Adds headers to FTM. (#75699)
These feature-test macros had no headers listed in their associated papers. This adds the expected headers. Fixes #75577
1 parent 42239d2 commit 9c18f03

File tree

5 files changed

+83
-116
lines changed

5 files changed

+83
-116
lines changed

libcxx/include/version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ __cpp_lib_expected 202211L <expected>
9393
__cpp_lib_filesystem 201703L <filesystem>
9494
__cpp_lib_format 202106L <format>
9595
__cpp_lib_format_ranges 202207L <format>
96-
__cpp_lib_format_uchar 202311L <>
96+
__cpp_lib_format_uchar 202311L <format>
9797
__cpp_lib_formatters 202302L <stacktrace> <thread>
9898
__cpp_lib_forward_like 202207L <utility>
9999
__cpp_lib_freestanding_algorithm 202311L <algorithm>
@@ -188,7 +188,7 @@ __cpp_lib_remove_cvref 201711L <type_traits>
188188
__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
189189
__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
190190
__cpp_lib_sample 201603L <algorithm>
191-
__cpp_lib_saturation_arithmetic 202311L <>
191+
__cpp_lib_saturation_arithmetic 202311L <numeric>
192192
__cpp_lib_scoped_lock 201703L <mutex>
193193
__cpp_lib_semaphore 201907L <semaphore>
194194
__cpp_lib_shared_mutex 201505L <shared_mutex>

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

Lines changed: 0 additions & 105 deletions
This file was deleted.

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/* Constant Value
1919
__cpp_lib_format 202106L [C++20]
2020
__cpp_lib_format_ranges 202207L [C++23]
21+
__cpp_lib_format_uchar 202311L [C++20]
2122
*/
2223

2324
#include <format>
@@ -33,6 +34,10 @@
3334
# error "__cpp_lib_format_ranges should not be defined before c++23"
3435
# endif
3536

37+
# ifdef __cpp_lib_format_uchar
38+
# error "__cpp_lib_format_uchar should not be defined before c++20"
39+
# endif
40+
3641
#elif TEST_STD_VER == 14
3742

3843
# ifdef __cpp_lib_format
@@ -43,6 +48,10 @@
4348
# error "__cpp_lib_format_ranges should not be defined before c++23"
4449
# endif
4550

51+
# ifdef __cpp_lib_format_uchar
52+
# error "__cpp_lib_format_uchar should not be defined before c++20"
53+
# endif
54+
4655
#elif TEST_STD_VER == 17
4756

4857
# ifdef __cpp_lib_format
@@ -53,6 +62,10 @@
5362
# error "__cpp_lib_format_ranges should not be defined before c++23"
5463
# endif
5564

65+
# ifdef __cpp_lib_format_uchar
66+
# error "__cpp_lib_format_uchar should not be defined before c++20"
67+
# endif
68+
5669
#elif TEST_STD_VER == 20
5770

5871
# if !defined(_LIBCPP_VERSION)
@@ -72,6 +85,13 @@
7285
# error "__cpp_lib_format_ranges should not be defined before c++23"
7386
# endif
7487

88+
# ifndef __cpp_lib_format_uchar
89+
# error "__cpp_lib_format_uchar should be defined in c++20"
90+
# endif
91+
# if __cpp_lib_format_uchar != 202311L
92+
# error "__cpp_lib_format_uchar should have the value 202311L in c++20"
93+
# endif
94+
7595
#elif TEST_STD_VER == 23
7696

7797
# if !defined(_LIBCPP_VERSION)
@@ -94,6 +114,13 @@
94114
# error "__cpp_lib_format_ranges should have the value 202207L in c++23"
95115
# endif
96116

117+
# ifndef __cpp_lib_format_uchar
118+
# error "__cpp_lib_format_uchar should be defined in c++23"
119+
# endif
120+
# if __cpp_lib_format_uchar != 202311L
121+
# error "__cpp_lib_format_uchar should have the value 202311L in c++23"
122+
# endif
123+
97124
#elif TEST_STD_VER > 23
98125

99126
# if !defined(_LIBCPP_VERSION)
@@ -116,5 +143,12 @@
116143
# error "__cpp_lib_format_ranges should have the value 202207L in c++26"
117144
# endif
118145

146+
# ifndef __cpp_lib_format_uchar
147+
# error "__cpp_lib_format_uchar should be defined in c++26"
148+
# endif
149+
# if __cpp_lib_format_uchar != 202311L
150+
# error "__cpp_lib_format_uchar should have the value 202311L in c++26"
151+
# endif
152+
119153
#endif // TEST_STD_VER > 23
120154

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

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515

1616
// Test the feature test macros defined by <numeric>
1717

18-
/* Constant Value
19-
__cpp_lib_constexpr_numeric 201911L [C++20]
20-
__cpp_lib_gcd_lcm 201606L [C++17]
21-
__cpp_lib_interpolate 201902L [C++20]
22-
__cpp_lib_parallel_algorithm 201603L [C++17]
23-
__cpp_lib_ranges_iota 202202L [C++23]
18+
/* Constant Value
19+
__cpp_lib_constexpr_numeric 201911L [C++20]
20+
__cpp_lib_gcd_lcm 201606L [C++17]
21+
__cpp_lib_interpolate 201902L [C++20]
22+
__cpp_lib_parallel_algorithm 201603L [C++17]
23+
__cpp_lib_ranges_iota 202202L [C++23]
24+
__cpp_lib_saturation_arithmetic 202311L [C++26]
2425
*/
2526

2627
#include <numeric>
@@ -48,6 +49,10 @@
4849
# error "__cpp_lib_ranges_iota should not be defined before c++23"
4950
# endif
5051

52+
# ifdef __cpp_lib_saturation_arithmetic
53+
# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
54+
# endif
55+
5156
#elif TEST_STD_VER == 14
5257

5358
# ifdef __cpp_lib_constexpr_numeric
@@ -70,6 +75,10 @@
7075
# error "__cpp_lib_ranges_iota should not be defined before c++23"
7176
# endif
7277

78+
# ifdef __cpp_lib_saturation_arithmetic
79+
# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
80+
# endif
81+
7382
#elif TEST_STD_VER == 17
7483

7584
# ifdef __cpp_lib_constexpr_numeric
@@ -104,6 +113,10 @@
104113
# error "__cpp_lib_ranges_iota should not be defined before c++23"
105114
# endif
106115

116+
# ifdef __cpp_lib_saturation_arithmetic
117+
# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
118+
# endif
119+
107120
#elif TEST_STD_VER == 20
108121

109122
# ifndef __cpp_lib_constexpr_numeric
@@ -144,6 +157,10 @@
144157
# error "__cpp_lib_ranges_iota should not be defined before c++23"
145158
# endif
146159

160+
# ifdef __cpp_lib_saturation_arithmetic
161+
# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
162+
# endif
163+
147164
#elif TEST_STD_VER == 23
148165

149166
# ifndef __cpp_lib_constexpr_numeric
@@ -193,6 +210,10 @@
193210
# endif
194211
# endif
195212

213+
# ifdef __cpp_lib_saturation_arithmetic
214+
# error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
215+
# endif
216+
196217
#elif TEST_STD_VER > 23
197218

198219
# ifndef __cpp_lib_constexpr_numeric
@@ -242,5 +263,18 @@
242263
# endif
243264
# endif
244265

266+
# if !defined(_LIBCPP_VERSION)
267+
# ifndef __cpp_lib_saturation_arithmetic
268+
# error "__cpp_lib_saturation_arithmetic should be defined in c++26"
269+
# endif
270+
# if __cpp_lib_saturation_arithmetic != 202311L
271+
# error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26"
272+
# endif
273+
# else // _LIBCPP_VERSION
274+
# ifdef __cpp_lib_saturation_arithmetic
275+
# error "__cpp_lib_saturation_arithmetic should not be defined because it is unimplemented in libc++!"
276+
# endif
277+
# endif
278+
245279
#endif // TEST_STD_VER > 23
246280

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,9 @@ def add_version_header(tc):
486486
"values": {
487487
"c++20": 202311 # DR P2909R4 Fix formatting of code units as integers
488488
},
489-
"headers": [""], # Note not in format
489+
"headers": [
490+
"format" # TODO verify this entry since the paper was underspecified.
491+
],
490492
},
491493
{
492494
"name": "__cpp_lib_formatters",
@@ -660,7 +662,7 @@ def add_version_header(tc):
660662
},
661663
{
662664
"name": "__cpp_lib_ios_noreplace",
663-
"values": { "c++23": 202207 },
665+
"values": {"c++23": 202207},
664666
"headers": ["ios"],
665667
},
666668
{
@@ -1010,7 +1012,9 @@ def add_version_header(tc):
10101012
{
10111013
"name": "__cpp_lib_saturation_arithmetic",
10121014
"values": {"c++26": 202311}, # P0543R3 Saturation arithmetic
1013-
"headers": [""], # Note not in <numerics>
1015+
"headers": [
1016+
"numeric" # TODO verify this entry since the paper was underspecified.
1017+
],
10141018
"unimplemented": True,
10151019
},
10161020
{

0 commit comments

Comments
 (0)