]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Define __cpp_lib_stdbit_h and __cpp_lib_stdckdint_h feature test macros.
authorTomasz Kamiński <tkaminsk@redhat.com>
Tue, 14 Apr 2026 14:30:36 +0000 (16:30 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Tue, 14 Apr 2026 15:09:26 +0000 (17:09 +0200)
This implements LWG4550: Need new feature test macros for <stdckdint.h>
and <stdbit.h>.

libstdc++-v3/ChangeLog:

* include/bits/version.def (stdbit_h, stdckdint_h): Define.
* include/bits/version.h: Regenerate.
* include/c_compatibility/stdbit.h (__cpp_lib_stdbit_h): Define
and use it in guards.
* include/c_compatibility/stdckdint.h (__cpp_lib_stdckdint_h):
Define and use it in guards.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/bits/version.def
libstdc++-v3/include/bits/version.h
libstdc++-v3/include/c_compatibility/stdbit.h
libstdc++-v3/include/c_compatibility/stdckdint.h

index 94fc1f859932f0bc3207b46293e22dfe3bd4b7cf..13dba4d63789686d1b5d8c0d2c537e89944e003c 100644 (file)
@@ -1871,6 +1871,22 @@ ftms = {
   };
 };
 
+ftms = {
+  name = stdbit_h;
+  values = {
+    v = 202603;
+    cxxmin = 26;
+  };
+};
+
+ftms = {
+  name = stdckdint_h;
+  values = {
+    v = 202603;
+    cxxmin = 26;
+  };
+};
+
 ftms = {
   name = adaptor_iterator_pair_constructor;
   values = {
index 402e67580eb3d861102618f783f2f1f4541d44a5..743f7e29fe2971b8a1add43dd0f59b7843f91bf5 100644 (file)
 #endif /* !defined(__cpp_lib_stdatomic_h) */
 #undef __glibcxx_want_stdatomic_h
 
+#if !defined(__cpp_lib_stdbit_h)
+# if (__cplusplus >  202302L)
+#  define __glibcxx_stdbit_h 202603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_stdbit_h)
+#   define __cpp_lib_stdbit_h 202603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_stdbit_h) */
+#undef __glibcxx_want_stdbit_h
+
+#if !defined(__cpp_lib_stdckdint_h)
+# if (__cplusplus >  202302L)
+#  define __glibcxx_stdckdint_h 202603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_stdckdint_h)
+#   define __cpp_lib_stdckdint_h 202603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_stdckdint_h) */
+#undef __glibcxx_want_stdckdint_h
+
 #if !defined(__cpp_lib_adaptor_iterator_pair_constructor)
 # if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED
 #  define __glibcxx_adaptor_iterator_pair_constructor 202106L
index 1fb691e36c184b2f747cd5e8fe43458bc54d326c..fa4ec0414c6e23b55021662064f50a1898d6265f 100644 (file)
 #ifndef _GLIBCXX_STDBIT_H
 #define _GLIBCXX_STDBIT_H
 
-#if __cplusplus > 202302L
+#define __glibcxx_want_stdbit_h
+#include <bits/version.h>
+
+#ifdef __cpp_lib_stdbit_h // C++ >= 26
+
 #include <bit>
 
 #define __STDC_VERSION_STDBIT_H__ 202311L
@@ -577,6 +581,6 @@ _GLIBCXX_STDBIT_FUNC(stdc_bit_floor);
 _GLIBCXX_STDBIT_FUNC(stdc_bit_ceil);
 #undef _GLIBCXX_STDBIT_FUNC
 #endif // !DOXYGEN
-#endif // C++26
+#endif // __cpp_lib_stdbit_h
 
 #endif // _GLIBCXX_STDBIT_H
index 5bdf4dc7b24b3e437291d1e798057deff74244aa..0f0b30cc8997ad6e347c69137ce1ec93bc40cf1b 100644 (file)
 #ifndef _GLIBCXX_STDCKDINT_H
 #define _GLIBCXX_STDCKDINT_H
 
-#if __cplusplus > 202302L
+#define __glibcxx_want_stdckdint_h
+#include <bits/version.h>
+
+#ifdef __cpp_lib_stdckdint_h // C++ >= 26
+
 #include <type_traits>
 #include <concepts>
 
@@ -96,6 +100,6 @@ using __gnu_cxx::ckd_sub;
 using __gnu_cxx::ckd_mul;
 #endif
 
-#endif // C++26
+#endif // __cpp_lib_stdckdint_h
 
 #endif // _GLIBCXX_STDCKDINT_H