Skip to content

[libc++][format] define __cpp_lib_format. #98275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_execution`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_format`` *unimplemented*
``__cpp_lib_format`` ``202110L``
---------------------------------------------------------- -----------------
``__cpp_lib_format_uchar`` ``202311L``
---------------------------------------------------------- -----------------
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ __cpp_lib_execution 201902L <execution>
201603L // C++17
__cpp_lib_expected 202211L <expected>
__cpp_lib_filesystem 201703L <filesystem>
__cpp_lib_format 202106L <format>
__cpp_lib_format 202110L <format>
__cpp_lib_format_path 202403L <filesystem>
__cpp_lib_format_ranges 202207L <format>
__cpp_lib_format_uchar 202311L <format>
Expand Down Expand Up @@ -403,7 +403,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_erase_if 202002L
# undef __cpp_lib_execution
// # define __cpp_lib_execution 201902L
// # define __cpp_lib_format 202106L
# define __cpp_lib_format 202110L
# define __cpp_lib_format_uchar 202311L
# define __cpp_lib_generic_unordered_lookup 201811L
# define __cpp_lib_int_pow2 202002L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Test the feature test macros defined by <format>

/* Constant Value
__cpp_lib_format 202106L [C++20]
__cpp_lib_format 202110L [C++20]
__cpp_lib_format_ranges 202207L [C++23]
__cpp_lib_format_uchar 202311L [C++20]
*/
Expand Down Expand Up @@ -68,17 +68,11 @@

#elif TEST_STD_VER == 20

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++20"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++20"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++20"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++20"
# endif

# ifdef __cpp_lib_format_ranges
Expand All @@ -94,17 +88,11 @@

#elif TEST_STD_VER == 23

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++23"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++23"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++23"
# endif

# ifndef __cpp_lib_format_ranges
Expand All @@ -123,17 +111,11 @@

#elif TEST_STD_VER > 23

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++26"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++26"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++26"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++26"
# endif

# ifndef __cpp_lib_format_ranges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
201902L [C++20]
__cpp_lib_expected 202211L [C++23]
__cpp_lib_filesystem 201703L [C++17]
__cpp_lib_format 202106L [C++20]
__cpp_lib_format 202110L [C++20]
__cpp_lib_format_path 202403L [C++26]
__cpp_lib_format_ranges 202207L [C++23]
__cpp_lib_format_uchar 202311L [C++20]
Expand Down Expand Up @@ -3618,17 +3618,11 @@
# endif
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++20"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++20"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++20"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++20"
# endif

# ifdef __cpp_lib_format_path
Expand Down Expand Up @@ -5063,17 +5057,11 @@
# endif
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++23"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++23"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++23"
# endif

# ifdef __cpp_lib_format_path
Expand Down Expand Up @@ -6748,17 +6736,11 @@
# endif
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++26"
# endif
# if __cpp_lib_format != 202106L
# error "__cpp_lib_format should have the value 202106L in c++26"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_format
# error "__cpp_lib_format should be defined in c++26"
# endif
# if __cpp_lib_format != 202110L
# error "__cpp_lib_format should have the value 202110L in c++26"
# endif

# if !defined(_LIBCPP_VERSION)
Expand Down
6 changes: 1 addition & 5 deletions libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,7 @@ def add_version_header(tc):
{
"name": "__cpp_lib_format",
"values": {
# "c++20": 201907 Not implemented P1361R2 Integration of chrono with text formatting
# "c++20": 202106 Fully implemented
# "c++20": 202110 Not implemented P2372R3 Fixing locale handling in chrono formatters
"c++20": 202106,
"c++20": 202110,
# "c++23": 202207, Not implemented P2419R2 Clarify handling of encodings in localized formatting of chrono types
# "c++26": 202306, P2637R3 Member Visit (implemented)
# "c++26": 202311, P2918R2 Runtime format strings II (implemented)
Expand All @@ -520,7 +517,6 @@ def add_version_header(tc):
# 202305 P2757R3 Type-checking format args
# 202306 P2637R3 Member Visit
"headers": ["format"],
"unimplemented": True,
},
{
"name": "__cpp_lib_format_path",
Expand Down
Loading