diff --git a/assert/assert.h b/assert/assert.h index 839406ddf7..373a1142d8 100644 --- a/assert/assert.h +++ b/assert/assert.h @@ -34,6 +34,12 @@ #define _ASSERT_H 1 #include +#if __GLIBC_USE (ISOC23) +# ifndef __STDC_VERSION_ASSERT_H__ +# define __STDC_VERSION_ASSERT_H__ 202311L +# endif +#endif + #if defined __cplusplus && __GNUC_PREREQ (2,95) # define __ASSERT_VOID_CAST static_cast #else diff --git a/include/limits.h b/include/limits.h index 6370ccd84d..baf79df609 100644 --- a/include/limits.h +++ b/include/limits.h @@ -180,7 +180,7 @@ /* The macros for _Bool are not defined by GCC's before GCC 11, or if _GNU_SOURCE is defined rather than enabling C23 support - with -std. */ + with -std; likewise for the version macro before GCC 13. */ #if __GLIBC_USE (ISOC23) # ifndef BOOL_MAX # define BOOL_MAX 1 @@ -188,6 +188,9 @@ # ifndef BOOL_WIDTH # define BOOL_WIDTH 1 # endif +# ifndef __STDC_VERSION_LIMITS_H__ +# define __STDC_VERSION_LIMITS_H__ 202311L +# endif #endif #ifdef __USE_POSIX diff --git a/libio/stdio.h b/libio/stdio.h index e0e70945fa..d5a44edfa6 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -29,6 +29,10 @@ __BEGIN_DECLS +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDIO_H__ 202311L +#endif + #define __need_size_t #define __need_NULL #include diff --git a/math/complex.h b/math/complex.h index c925c5c0a3..2c84953429 100644 --- a/math/complex.h +++ b/math/complex.h @@ -33,6 +33,10 @@ __BEGIN_DECLS +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_COMPLEX_H__ 202311L +#endif + /* We might need to add support for more compilers here. But since ISO C99 is out hopefully all maintained compilers will soon provide the data types `float complex' and `double complex'. */ diff --git a/math/fenv.h b/math/fenv.h index 07bbbf61df..8db719f687 100644 --- a/math/fenv.h +++ b/math/fenv.h @@ -65,6 +65,10 @@ __BEGIN_DECLS +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_FENV_H__ 202311L +#endif + /* Floating-point exception handling. */ /* Clear the supported exceptions represented by EXCEPTS. */ diff --git a/math/math.h b/math/math.h index 5f1933a2f9..26cea186fc 100644 --- a/math/math.h +++ b/math/math.h @@ -39,6 +39,10 @@ __BEGIN_DECLS /* Gather machine dependent type support. */ #include +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_MATH_H__ 202311L +#endif + /* Value returned on overflow. With IEEE 754 floating point, this is +Infinity, otherwise the largest representable positive value. */ #if __GNUC_PREREQ (3, 3) diff --git a/math/tgmath.h b/math/tgmath.h index 27a87c599d..89ee94e1f7 100644 --- a/math/tgmath.h +++ b/math/tgmath.h @@ -30,6 +30,10 @@ #include #include +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_TGMATH_H__ 202311L +#endif + /* There are two variant implementations of type-generic macros in this file: one for GCC 8 and later, using __builtin_tgmath and diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h index 7a4760e291..f232ddcd6b 100644 --- a/setjmp/setjmp.h +++ b/setjmp/setjmp.h @@ -26,6 +26,10 @@ __BEGIN_DECLS +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_SETJMP_H__ 202311L +#endif + #include /* Get `__jmp_buf'. */ #include diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h index 6b64917b54..13cb7fae36 100644 --- a/stdlib/inttypes.h +++ b/stdlib/inttypes.h @@ -23,6 +23,11 @@ #define _INTTYPES_H 1 #include + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_INTTYPES_H__ 202311L +#endif + /* Get the type definitions. */ #include diff --git a/stdlib/stdint.h b/stdlib/stdint.h index 302230914c..814718a366 100644 --- a/stdlib/stdint.h +++ b/stdlib/stdint.h @@ -28,6 +28,10 @@ #include #include +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDINT_H__ 202311L +#endif + /* Exact integral types. */ /* Signed. */ diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 4a79c612de..a1ea003658 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -35,6 +35,10 @@ __BEGIN_DECLS #define _STDLIB_H 1 +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDLIB_H__ 202311L +#endif + #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H /* XPG requires a few symbols from being defined. */ # include diff --git a/string/string.h b/string/string.h index 1dc5995c17..b8747506db 100644 --- a/string/string.h +++ b/string/string.h @@ -27,6 +27,10 @@ __BEGIN_DECLS +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STRING_H__ 202311L +#endif + /* Get size_t and NULL from . */ #define __need_size_t #define __need_NULL diff --git a/time/time.h b/time/time.h index 4913508d86..ca4f2828de 100644 --- a/time/time.h +++ b/time/time.h @@ -28,6 +28,10 @@ #define __need_NULL #include +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_TIME_H__ 202311L +#endif + /* This defines CLOCKS_PER_SEC, which is the number of processor clock ticks per second, and possibly a number of other constants. */ #include diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h index 335bfa343d..c774b1cd34 100644 --- a/wcsmbs/uchar.h +++ b/wcsmbs/uchar.h @@ -31,6 +31,10 @@ #include #include +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_UCHAR_H__ 202311L +#endif + /* Declare the C23 char8_t typedef in C23 modes, but only if the C++ __cpp_char8_t feature test macro is not defined. */ #if __GLIBC_USE (ISOC23) && !defined __cpp_char8_t diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 19f71f90cf..e7170d2173 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -60,6 +60,10 @@ typedef __gnuc_va_list va_list; # include #endif +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_WCHAR_H__ 202311L +#endif + /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_WCHAR_H_PROTO