From: Tomasz Kamiński Date: Tue, 14 Apr 2026 14:30:36 +0000 (+0200) Subject: libstdc++: Define __cpp_lib_stdbit_h and __cpp_lib_stdckdint_h feature test macros. X-Git-Tag: basepoints/gcc-17~196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62d243c91c05b13490aac10b4faad81e86ea6bbf;p=thirdparty%2Fgcc.git libstdc++: Define __cpp_lib_stdbit_h and __cpp_lib_stdckdint_h feature test macros. This implements LWG4550: Need new feature test macros for and . 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 Signed-off-by: Tomasz Kamiński --- diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 94fc1f85993..13dba4d6378 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -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 = { diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 402e67580eb..743f7e29fe2 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -2076,6 +2076,26 @@ #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 diff --git a/libstdc++-v3/include/c_compatibility/stdbit.h b/libstdc++-v3/include/c_compatibility/stdbit.h index 1fb691e36c1..fa4ec0414c6 100644 --- a/libstdc++-v3/include/c_compatibility/stdbit.h +++ b/libstdc++-v3/include/c_compatibility/stdbit.h @@ -29,7 +29,11 @@ #ifndef _GLIBCXX_STDBIT_H #define _GLIBCXX_STDBIT_H -#if __cplusplus > 202302L +#define __glibcxx_want_stdbit_h +#include + +#ifdef __cpp_lib_stdbit_h // C++ >= 26 + #include #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 diff --git a/libstdc++-v3/include/c_compatibility/stdckdint.h b/libstdc++-v3/include/c_compatibility/stdckdint.h index 5bdf4dc7b24..0f0b30cc899 100644 --- a/libstdc++-v3/include/c_compatibility/stdckdint.h +++ b/libstdc++-v3/include/c_compatibility/stdckdint.h @@ -29,7 +29,11 @@ #ifndef _GLIBCXX_STDCKDINT_H #define _GLIBCXX_STDCKDINT_H -#if __cplusplus > 202302L +#define __glibcxx_want_stdckdint_h +#include + +#ifdef __cpp_lib_stdckdint_h // C++ >= 26 + #include #include @@ -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