From: Hugo Beauzée-Luyssen <[email protected]>
__cpp_lib_chrono only reaches the C++20 threshold when
_GLIBCXX_USE_CXX11_ABI is set. But chrono::tzdb and the rest of the
C++20 calendar/timezone API are also declared when
_GLIBCXX_USE_DUAL_ABI is unset (old-ABI-only builds), the same
condition already used throughout <chrono> and <bits/chrono_io.h>.
Add a tier for that case in version.def, defining the macro to
201803 (distinct from the full 201907 new-ABI value) so it reflects
what's actually declared. <chrono>'s own include guard for the
headers tzdb needs can then go back to the plain __cpp_lib_chrono
check.
libstdc++-v3/ChangeLog:
* include/bits/version.def (chrono): Add a 201803 tier for
old-ABI-only builds.
* include/bits/version.h: Regenerate.
* include/std/chrono: Simplify include guard now that
__cpp_lib_chrono accounts for old-ABI-only builds.
Assisted-by: Claude (claude-sonnet-5)
Signed-off-by: Hugo Beauzée-Luyssen <[email protected]>
---
libstdc++-v3/include/bits/version.def | 6 ++++++
libstdc++-v3/include/bits/version.h | 5 +++++
libstdc++-v3/include/std/chrono | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/bits/version.def
b/libstdc++-v3/include/bits/version.def
index 9c523581c65..6db0d22b788 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -624,6 +624,12 @@ ftms = {
hosted = yes;
cxx11abi = yes; // std::chrono::tzdb requires cxx11 std::string
};
+ values = {
+ v = 201803;
+ cxxmin = 20;
+ hosted = yes;
+ extra_cond = "!_GLIBCXX_USE_DUAL_ABI";
+ };
values = {
v = 201611;
cxxmin = 17;
diff --git a/libstdc++-v3/include/bits/version.h
b/libstdc++-v3/include/bits/version.h
index e0003054af6..07af61af056 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -691,6 +691,11 @@
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)
# define __cpp_lib_chrono 201907L
# endif
+# elif (__cplusplus >= 202002L) && _GLIBCXX_HOSTED && (!_GLIBCXX_USE_DUAL_ABI)
+# define __glibcxx_chrono 201803L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)
+# define __cpp_lib_chrono 201803L
+# endif
# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
# define __glibcxx_chrono 201611L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 4116f1c815e..ce0902522d7 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -57,7 +57,7 @@
# include <bits/stl_algo.h> // upper_bound
# include <bits/range_access.h> // begin/end for arrays
#endif
-#if __cpp_lib_chrono >= 201803L // C++20 && HOSTED && USE_CXX11_ABI
+#if __cpp_lib_chrono >= 201803L
# include <sstream>
# include <string>
# include <vector>
--
2.43.0