]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add feature test macros for POSIX.1-2024.
authorCollin Funk <collin.funk1@gmail.com>
Fri, 23 May 2025 04:00:05 +0000 (21:00 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 5 Nov 2025 02:00:57 +0000 (18:00 -0800)
* include/features.h (_POSIX_C_SOURCE): Document the value of 202405L
for POSIX.1-2024.  Set it to 202405L when _GNU_SOURCE or _DEFAULT_SOURCE
is defined.
(_XOPEN_SOURCE): Document the value of 800 for POSIX-1.2024.  Set it to
800 when _GNU_SOURCE is defined.
(__USE_XOPEN2K24, __USE_XOPEN2K24XSI): New internal macros.  Set them
when _POSIX_C_SOURCE is 202405L or greater and/or when _XOPEN_SOURCE is
800 or greater.
* manual/creature.texi (Feature Test Macros): Document the new values
for _POSIX_C_SOURCE and _XOPEN_SOURCE.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
include/features.h
manual/creature.texi

index 673c4036cde5cea2578eff3717d0891e85c58a25..0ad04e240bb94f12304ca8b2cfff0287110870f4 100644 (file)
                        if >=199506L, add IEEE Std 1003.1c-1995;
                        if >=200112L, all of IEEE 1003.1-2004
                        if >=200809L, all of IEEE 1003.1-2008
+                       if >=202405L, all of IEEE 1003.1-2024
    _XOPEN_SOURCE       Includes POSIX and XPG things.  Set to 500 if
                        Single Unix conformance is wanted, to 600 for the
-                       sixth revision, to 700 for the seventh revision.
+                       sixth revision, to 700 for the seventh revision,
+                       to 800 for the eighth revision.
    _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
    _LARGEFILE_SOURCE   Some more functions for correct standard I/O.
    _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
@@ -69,7 +71,7 @@
    options such as `-std=c99', define __STRICT_ANSI__.  If none of
    these are defined, or if _DEFAULT_SOURCE is defined, the default is
    to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
-   200809L, as well as enabling miscellaneous functions from BSD and
+   202405L, as well as enabling miscellaneous functions from BSD and
    SVID.  If more than one of these are defined, they accumulate.  For
    example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
    give you ISO C, 1003.1, and 1003.2, but nothing else.
@@ -96,6 +98,8 @@
    __USE_XOPEN2KXSI     Define XPG6 XSI things.
    __USE_XOPEN2K8       Define XPG7 things.
    __USE_XOPEN2K8XSI    Define XPG7 XSI things.
+   __USE_XOPEN2K24      Define XPG8 things.
+   __USE_XOPEN2K24XSI   Define XPG8 XSI things.
    __USE_LARGEFILE     Define correct standard I/O things.
    __USE_LARGEFILE64   Define LFS things with separate names.
    __USE_FILE_OFFSET64 Define 64bit interface as default.
 #undef __USE_XOPEN2KXSI
 #undef __USE_XOPEN2K8
 #undef __USE_XOPEN2K8XSI
+#undef __USE_XOPEN2K24
+#undef __USE_XOPEN2K24XSI
 #undef __USE_LARGEFILE
 #undef __USE_LARGEFILE64
 #undef __USE_FILE_OFFSET64
 # undef  _POSIX_SOURCE
 # define _POSIX_SOURCE 1
 # undef  _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE       200809L
+# define _POSIX_C_SOURCE       202405L
 # undef  _XOPEN_SOURCE
-# define _XOPEN_SOURCE 700
+# define _XOPEN_SOURCE 800
 # undef  _XOPEN_SOURCE_EXTENDED
 # define _XOPEN_SOURCE_EXTENDED        1
 # undef         _LARGEFILE64_SOURCE
 #endif
 
 /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
-   is defined, use POSIX.1-2008 (or another version depending on
+   is defined, use POSIX.1-2024 (or another version depending on
    _XOPEN_SOURCE).  */
 #ifdef _DEFAULT_SOURCE
 # if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE
 # undef  _POSIX_SOURCE
 # define _POSIX_SOURCE 1
 # undef  _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE       200809L
+# define _POSIX_C_SOURCE       202405L
 #endif
 
 #if ((!defined __STRICT_ANSI__                                 \
 #  define _POSIX_C_SOURCE      199506L
 # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
 #  define _POSIX_C_SOURCE      200112L
-# else
+# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 800
 #  define _POSIX_C_SOURCE      200809L
+# else
+#  define _POSIX_C_SOURCE      202405L
 # endif
 # define __USE_POSIX_IMPLICITLY        1
 #endif
 # define _ATFILE_SOURCE        1
 #endif
 
+#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 202405L
+# define __USE_XOPEN2K24       1
+#endif
+
 #ifdef _XOPEN_SOURCE
 # define __USE_XOPEN   1
 # if (_XOPEN_SOURCE - 0) >= 500
 #   if (_XOPEN_SOURCE - 0) >= 700
 #    define __USE_XOPEN2K8     1
 #    define __USE_XOPEN2K8XSI  1
+#    if (_XOPEN_SOURCE - 0) >= 800
+#     define __USE_XOPEN2K24   1
+#     define __USE_XOPEN2K24XSI        1
+#    endif
 #   endif
 #   define __USE_XOPEN2K       1
 #   define __USE_XOPEN2KXSI    1
index 59a610874b8dab1e19688c9a213027533e8461c8..90f9f8e35b2cad4520990838b1d8b25d36005a33 100644 (file)
@@ -73,6 +73,10 @@ If you define this macro to a value greater than or equal to
 @code{200809L}, then the functionality from the 2008 edition of the
 POSIX standard (IEEE Standard 1003.1-2008) is made available.
 
+If you define this macro to a value greater than or equal to
+@code{202405L}, then the functionality from the 2024 edition of the
+POSIX standard (IEEE Standard 1003.1-2024) is made available.
+
 Greater values for @code{_POSIX_C_SOURCE} will enable future extensions.
 The POSIX standards process will define these values as necessary, and
 @theglibc{} should support them some time after they become standardized.
@@ -104,7 +108,7 @@ all functionality described so far plus some new definitions from the
 Single Unix Specification, @w{version 2}.  The value @math{600}
 (corresponding to the sixth revision) includes definitions from SUSv3,
 and using @math{700} (the seventh revision) includes definitions from
-SUSv4.
+SUSv4.  The value @math{800} includes definitions from POSIX.1-2024.
 @end defvr
 
 @defvr Macro _LARGEFILE_SOURCE