From 96f789d25f99e889fab8cba2c20cd6f80a9b4a0a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 16 Jul 2024 10:22:40 +0100 Subject: [PATCH] libstdc++: Bump __cpp_lib_format value for std::runtime_format We already supported this feature, but couldn't set the feature test macro accordingly because we were missing support for older features. Now that we support all the older changes, we can set this to the correct value. libstdc++-v3/ChangeLog: * include/bits/version.def (format): Update value for C++26. * include/bits/version.h: Regenerate. * include/std/format (runtime_format, wruntime_format): Check __cpp_lib_format instead of __cplusplus. * testsuite/std/format/functions/format.cc: Update expected value of macro for C++26 mode. --- libstdc++-v3/include/bits/version.def | 2 +- libstdc++-v3/include/bits/version.h | 4 ++-- libstdc++-v3/include/std/format | 2 +- libstdc++-v3/testsuite/std/format/functions/format.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index ec330911d66..ee0a9e45c44 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -1171,7 +1171,7 @@ ftms = { // 202306 P2637R3 Member visit // 202311 P2918R2 Runtime format strings II values = { - v = 202306; + v = 202311; cxxmin = 26; hosted = yes; }; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 148ee87e087..cee497d7443 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -1310,9 +1310,9 @@ #if !defined(__cpp_lib_format) # if (__cplusplus > 202302L) && _GLIBCXX_HOSTED -# define __glibcxx_format 202306L +# define __glibcxx_format 202311L # if defined(__glibcxx_want_all) || defined(__glibcxx_want_format) -# define __cpp_lib_format 202306L +# define __cpp_lib_format 202311L # endif # elif (__cplusplus >= 202002L) && _GLIBCXX_HOSTED # define __glibcxx_format 202304L diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 715fdf93492..3280dadfb90 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -155,7 +155,7 @@ namespace __format = basic_format_string...>; #endif -#if __cplusplus > 202302L +#if __cpp_lib_format >= 202311L // >= C++26 [[__gnu__::__always_inline__]] inline __format::_Runtime_format_string runtime_format(string_view __fmt) noexcept diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc index 0549d171e5a..7fc42017045 100644 --- a/libstdc++-v3/testsuite/std/format/functions/format.cc +++ b/libstdc++-v3/testsuite/std/format/functions/format.cc @@ -8,7 +8,7 @@ # error "Feature test macro for std::format is missing in " #elif __cpp_lib_format < 202110L # error "Feature test macro for std::format has wrong value in " -#elif __cplusplus > 202302L && __cpp_lib_format < 202306L +#elif __cplusplus > 202302L && __cpp_lib_format < 202311L # error "Feature test macro for std::format has wrong value in " #endif @@ -24,7 +24,7 @@ # error "Feature test macro for std::format is missing in " #elif __cpp_lib_format < 202110L # error "Feature test macro for std::format has wrong value in " -#elif __cplusplus > 202302L && __cpp_lib_format < 202306L +#elif __cplusplus > 202302L && __cpp_lib_format < 202311L # error "Feature test macro for std::format has wrong value in " #endif -- 2.47.2