Skip to content

Commit a4bef0c

Browse files
[libc++] Mark P2845R8 __cpp_lib_format_path and P2587R3 __cpp_lib_to_string as C++26 (#93255)
[P2845R8](https://wg21.link/P2845R8) "Formatting of `std::filesystem::path`" and [P2587R3](https://wg21.link/P2587R3) "`to_string` or not `to_string`" are C++26 features, so they should be marked accordingly in `generate_feature_test_macro_components.py`. I verified that without my changes, running the script produced no edits. Then with my changes, I ran the script to regenerate all files, with no other manual edits. Found while running libc++'s tests with MSVC's STL, which noticed this because it's currently a C++23-only implementation. Note that @H-G-Hristov has a draft implementation of P2587R3: #78100
1 parent debdbed commit a4bef0c

File tree

6 files changed

+36
-72
lines changed

6 files changed

+36
-72
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,6 @@ Status
326326
---------------------------------------------------------- -----------------
327327
``__cpp_lib_expected`` ``202211L``
328328
---------------------------------------------------------- -----------------
329-
``__cpp_lib_format_path`` *unimplemented*
330-
---------------------------------------------------------- -----------------
331329
``__cpp_lib_format_ranges`` ``202207L``
332330
---------------------------------------------------------- -----------------
333331
``__cpp_lib_formatters`` *unimplemented*
@@ -386,8 +384,6 @@ Status
386384
---------------------------------------------------------- -----------------
387385
``__cpp_lib_string_resize_and_overwrite`` ``202110L``
388386
---------------------------------------------------------- -----------------
389-
``__cpp_lib_to_string`` *unimplemented*
390-
---------------------------------------------------------- -----------------
391387
``__cpp_lib_to_underlying`` ``202102L``
392388
---------------------------------------------------------- -----------------
393389
``__cpp_lib_tuple_like`` *unimplemented*
@@ -412,6 +408,8 @@ Status
412408
---------------------------------------------------------- -----------------
413409
``__cpp_lib_default_template_type_for_algorithm_values`` *unimplemented*
414410
---------------------------------------------------------- -----------------
411+
``__cpp_lib_format_path`` *unimplemented*
412+
---------------------------------------------------------- -----------------
415413
``__cpp_lib_freestanding_algorithm`` *unimplemented*
416414
---------------------------------------------------------- -----------------
417415
``__cpp_lib_freestanding_array`` *unimplemented*
@@ -466,6 +464,8 @@ Status
466464
---------------------------------------------------------- -----------------
467465
``__cpp_lib_to_chars`` *unimplemented*
468466
---------------------------------------------------------- -----------------
467+
``__cpp_lib_to_string`` *unimplemented*
468+
---------------------------------------------------------- -----------------
469469
``__cpp_lib_tuple_like`` *unimplemented*
470470
========================================================== =================
471471

libcxx/include/version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ __cpp_lib_void_t 201411L <type_traits>
459459
# define __cpp_lib_constexpr_typeinfo 202106L
460460
# define __cpp_lib_containers_ranges 202202L
461461
# define __cpp_lib_expected 202211L
462-
// # define __cpp_lib_format_path 202403L
463462
# define __cpp_lib_format_ranges 202207L
464463
// # define __cpp_lib_formatters 202302L
465464
# define __cpp_lib_forward_like 202207L
@@ -490,7 +489,6 @@ __cpp_lib_void_t 201411L <type_traits>
490489
# define __cpp_lib_stdatomic_h 202011L
491490
# define __cpp_lib_string_contains 202011L
492491
# define __cpp_lib_string_resize_and_overwrite 202110L
493-
// # define __cpp_lib_to_string 202306L
494492
# define __cpp_lib_to_underlying 202102L
495493
// # define __cpp_lib_tuple_like 202207L
496494
# define __cpp_lib_unreachable 202202L
@@ -506,6 +504,7 @@ __cpp_lib_void_t 201411L <type_traits>
506504
// # define __cpp_lib_copyable_function 202306L
507505
// # define __cpp_lib_debugging 202311L
508506
// # define __cpp_lib_default_template_type_for_algorithm_values 202403L
507+
// # define __cpp_lib_format_path 202403L
509508
// # define __cpp_lib_freestanding_algorithm 202311L
510509
// # define __cpp_lib_freestanding_array 202311L
511510
// # define __cpp_lib_freestanding_cstring 202306L
@@ -537,6 +536,7 @@ __cpp_lib_void_t 201411L <type_traits>
537536
// # define __cpp_lib_text_encoding 202306L
538537
# undef __cpp_lib_to_chars
539538
// # define __cpp_lib_to_chars 202306L
539+
// # define __cpp_lib_to_string 202306L
540540
# undef __cpp_lib_tuple_like
541541
// # define __cpp_lib_tuple_like 202311L
542542
#endif

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/* Constant Value
2121
__cpp_lib_char8_t 201907L [C++20]
2222
__cpp_lib_filesystem 201703L [C++17]
23-
__cpp_lib_format_path 202403L [C++23]
23+
__cpp_lib_format_path 202403L [C++26]
2424
*/
2525

2626
#include <filesystem>
@@ -37,7 +37,7 @@
3737
# endif
3838

3939
# ifdef __cpp_lib_format_path
40-
# error "__cpp_lib_format_path should not be defined before c++23"
40+
# error "__cpp_lib_format_path should not be defined before c++26"
4141
# endif
4242

4343
#elif TEST_STD_VER == 14
@@ -51,7 +51,7 @@
5151
# endif
5252

5353
# ifdef __cpp_lib_format_path
54-
# error "__cpp_lib_format_path should not be defined before c++23"
54+
# error "__cpp_lib_format_path should not be defined before c++26"
5555
# endif
5656

5757
#elif TEST_STD_VER == 17
@@ -74,7 +74,7 @@
7474
# endif
7575

7676
# ifdef __cpp_lib_format_path
77-
# error "__cpp_lib_format_path should not be defined before c++23"
77+
# error "__cpp_lib_format_path should not be defined before c++26"
7878
# endif
7979

8080
#elif TEST_STD_VER == 20
@@ -106,7 +106,7 @@
106106
# endif
107107

108108
# ifdef __cpp_lib_format_path
109-
# error "__cpp_lib_format_path should not be defined before c++23"
109+
# error "__cpp_lib_format_path should not be defined before c++26"
110110
# endif
111111

112112
#elif TEST_STD_VER == 23
@@ -137,17 +137,8 @@
137137
# endif
138138
# endif
139139

140-
# if !defined(_LIBCPP_VERSION)
141-
# ifndef __cpp_lib_format_path
142-
# error "__cpp_lib_format_path should be defined in c++23"
143-
# endif
144-
# if __cpp_lib_format_path != 202403L
145-
# error "__cpp_lib_format_path should have the value 202403L in c++23"
146-
# endif
147-
# else // _LIBCPP_VERSION
148-
# ifdef __cpp_lib_format_path
149-
# error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
150-
# endif
140+
# ifdef __cpp_lib_format_path
141+
# error "__cpp_lib_format_path should not be defined before c++26"
151142
# endif
152143

153144
#elif TEST_STD_VER > 23

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
__cpp_lib_string_udls 201304L [C++14]
3030
__cpp_lib_string_view 201606L [C++17]
3131
201803L [C++20]
32-
__cpp_lib_to_string 202306L [C++23]
32+
__cpp_lib_to_string 202306L [C++26]
3333
*/
3434

3535
#include <string>
@@ -86,7 +86,7 @@
8686
# endif
8787

8888
# ifdef __cpp_lib_to_string
89-
# error "__cpp_lib_to_string should not be defined before c++23"
89+
# error "__cpp_lib_to_string should not be defined before c++26"
9090
# endif
9191

9292
#elif TEST_STD_VER == 14
@@ -143,7 +143,7 @@
143143
# endif
144144

145145
# ifdef __cpp_lib_to_string
146-
# error "__cpp_lib_to_string should not be defined before c++23"
146+
# error "__cpp_lib_to_string should not be defined before c++26"
147147
# endif
148148

149149
#elif TEST_STD_VER == 17
@@ -209,7 +209,7 @@
209209
# endif
210210

211211
# ifdef __cpp_lib_to_string
212-
# error "__cpp_lib_to_string should not be defined before c++23"
212+
# error "__cpp_lib_to_string should not be defined before c++26"
213213
# endif
214214

215215
#elif TEST_STD_VER == 20
@@ -293,7 +293,7 @@
293293
# endif
294294

295295
# ifdef __cpp_lib_to_string
296-
# error "__cpp_lib_to_string should not be defined before c++23"
296+
# error "__cpp_lib_to_string should not be defined before c++26"
297297
# endif
298298

299299
#elif TEST_STD_VER == 23
@@ -385,17 +385,8 @@
385385
# error "__cpp_lib_string_view should have the value 201803L in c++23"
386386
# endif
387387

388-
# if !defined(_LIBCPP_VERSION)
389-
# ifndef __cpp_lib_to_string
390-
# error "__cpp_lib_to_string should be defined in c++23"
391-
# endif
392-
# if __cpp_lib_to_string != 202306L
393-
# error "__cpp_lib_to_string should have the value 202306L in c++23"
394-
# endif
395-
# else // _LIBCPP_VERSION
396-
# ifdef __cpp_lib_to_string
397-
# error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!"
398-
# endif
388+
# ifdef __cpp_lib_to_string
389+
# error "__cpp_lib_to_string should not be defined before c++26"
399390
# endif
400391

401392
#elif TEST_STD_VER > 23

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

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
__cpp_lib_expected 202211L [C++23]
8989
__cpp_lib_filesystem 201703L [C++17]
9090
__cpp_lib_format 202106L [C++20]
91-
__cpp_lib_format_path 202403L [C++23]
91+
__cpp_lib_format_path 202403L [C++26]
9292
__cpp_lib_format_ranges 202207L [C++23]
9393
__cpp_lib_format_uchar 202311L [C++20]
9494
__cpp_lib_formatters 202302L [C++23]
@@ -216,7 +216,7 @@
216216
__cpp_lib_to_array 201907L [C++20]
217217
__cpp_lib_to_chars 201611L [C++17]
218218
202306L [C++26]
219-
__cpp_lib_to_string 202306L [C++23]
219+
__cpp_lib_to_string 202306L [C++26]
220220
__cpp_lib_to_underlying 202102L [C++23]
221221
__cpp_lib_transformation_trait_aliases 201304L [C++14]
222222
__cpp_lib_transparent_operators 201210L [C++14]
@@ -513,7 +513,7 @@
513513
# endif
514514

515515
# ifdef __cpp_lib_format_path
516-
# error "__cpp_lib_format_path should not be defined before c++23"
516+
# error "__cpp_lib_format_path should not be defined before c++26"
517517
# endif
518518

519519
# ifdef __cpp_lib_format_ranges
@@ -1005,7 +1005,7 @@
10051005
# endif
10061006

10071007
# ifdef __cpp_lib_to_string
1008-
# error "__cpp_lib_to_string should not be defined before c++23"
1008+
# error "__cpp_lib_to_string should not be defined before c++26"
10091009
# endif
10101010

10111011
# ifdef __cpp_lib_to_underlying
@@ -1348,7 +1348,7 @@
13481348
# endif
13491349

13501350
# ifdef __cpp_lib_format_path
1351-
# error "__cpp_lib_format_path should not be defined before c++23"
1351+
# error "__cpp_lib_format_path should not be defined before c++26"
13521352
# endif
13531353

13541354
# ifdef __cpp_lib_format_ranges
@@ -1891,7 +1891,7 @@
18911891
# endif
18921892

18931893
# ifdef __cpp_lib_to_string
1894-
# error "__cpp_lib_to_string should not be defined before c++23"
1894+
# error "__cpp_lib_to_string should not be defined before c++26"
18951895
# endif
18961896

18971897
# ifdef __cpp_lib_to_underlying
@@ -2303,7 +2303,7 @@
23032303
# endif
23042304

23052305
# ifdef __cpp_lib_format_path
2306-
# error "__cpp_lib_format_path should not be defined before c++23"
2306+
# error "__cpp_lib_format_path should not be defined before c++26"
23072307
# endif
23082308

23092309
# ifdef __cpp_lib_format_ranges
@@ -2972,7 +2972,7 @@
29722972
# endif
29732973

29742974
# ifdef __cpp_lib_to_string
2975-
# error "__cpp_lib_to_string should not be defined before c++23"
2975+
# error "__cpp_lib_to_string should not be defined before c++26"
29762976
# endif
29772977

29782978
# ifdef __cpp_lib_to_underlying
@@ -3543,7 +3543,7 @@
35433543
# endif
35443544

35453545
# ifdef __cpp_lib_format_path
3546-
# error "__cpp_lib_format_path should not be defined before c++23"
3546+
# error "__cpp_lib_format_path should not be defined before c++26"
35473547
# endif
35483548

35493549
# ifdef __cpp_lib_format_ranges
@@ -4350,7 +4350,7 @@
43504350
# endif
43514351

43524352
# ifdef __cpp_lib_to_string
4353-
# error "__cpp_lib_to_string should not be defined before c++23"
4353+
# error "__cpp_lib_to_string should not be defined before c++26"
43544354
# endif
43554355

43564356
# ifdef __cpp_lib_to_underlying
@@ -4971,17 +4971,8 @@
49714971
# endif
49724972
# endif
49734973

4974-
# if !defined(_LIBCPP_VERSION)
4975-
# ifndef __cpp_lib_format_path
4976-
# error "__cpp_lib_format_path should be defined in c++23"
4977-
# endif
4978-
# if __cpp_lib_format_path != 202403L
4979-
# error "__cpp_lib_format_path should have the value 202403L in c++23"
4980-
# endif
4981-
# else // _LIBCPP_VERSION
4982-
# ifdef __cpp_lib_format_path
4983-
# error "__cpp_lib_format_path should not be defined because it is unimplemented in libc++!"
4984-
# endif
4974+
# ifdef __cpp_lib_format_path
4975+
# error "__cpp_lib_format_path should not be defined before c++26"
49854976
# endif
49864977

49874978
# ifndef __cpp_lib_format_ranges
@@ -5943,17 +5934,8 @@
59435934
# endif
59445935
# endif
59455936

5946-
# if !defined(_LIBCPP_VERSION)
5947-
# ifndef __cpp_lib_to_string
5948-
# error "__cpp_lib_to_string should be defined in c++23"
5949-
# endif
5950-
# if __cpp_lib_to_string != 202306L
5951-
# error "__cpp_lib_to_string should have the value 202306L in c++23"
5952-
# endif
5953-
# else // _LIBCPP_VERSION
5954-
# ifdef __cpp_lib_to_string
5955-
# error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!"
5956-
# endif
5937+
# ifdef __cpp_lib_to_string
5938+
# error "__cpp_lib_to_string should not be defined before c++26"
59575939
# endif
59585940

59595941
# ifndef __cpp_lib_to_underlying

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def add_version_header(tc):
515515
},
516516
{
517517
"name": "__cpp_lib_format_path",
518-
"values": {"c++23": 202403}, # P2845R8: Formatting of std::filesystem::path
518+
"values": {"c++26": 202403}, # P2845R8: Formatting of std::filesystem::path
519519
"headers": ["filesystem"],
520520
"unimplemented": True,
521521
},
@@ -1270,7 +1270,7 @@ def add_version_header(tc):
12701270
},
12711271
{
12721272
"name": "__cpp_lib_to_string",
1273-
"values": {"c++23": 202306}, # P2587R3 to_string or not to_string
1273+
"values": {"c++26": 202306}, # P2587R3 to_string or not to_string
12741274
"headers": ["string"],
12751275
"unimplemented": True,
12761276
},

0 commit comments

Comments
 (0)