PING: [PATCH] Add feature test macro _ISOC2Y_SOURCE
Lenard Mollenkopf
admin@lenardmollenkopf.com
Fri Nov 1 08:47:54 GMT 2024
On 10/22/24 15:17, Lenard Mollenkopf wrote:
> This patch starts preparation for C2Y support in glibc headers by
> adding a feature test macro _ISOC2Y_SOURCE and corresponding
> __GLIBC_USE (ISOC2Y). (I mostly copied the work of Joseph Myers
> for C2X). As with other such macros, C2Y features are also
> enabled by compiling for a standard newer than C23, or by using
> _GNU_SOURCE.
>
> This patch does not itself enable anything new in the headers for C2Y;
> that is to be done in followup patches. (For example an implementation
> of WG14 N3349.)
>
> Once C2Y becomes an actual standard we'll presumably move to using the
> actual year in the feature test macro and __GLIBC_USE, with some
> period when both macro spellings are accepted, as was done with
> _ISOC2X_SOURCE.
>
> Tested for x86_64.
>
> * include/features.h (_ISOC2Y_SOURCE): New feature test macro.
> Undefine and define to 1 if [_GNU_SOURCE].
> (__GLIBC_USE_ISOC2Y): New macro. Undefine and redefine depending
> on [_ISOC2Y_SOURCE] and [__STDC_VERSION__ > 202311L].
> (__GLIBC_USE_ISOC23): Also define to 1 if [_ISOC2Y__SOURCE].
> (__USE_ISOC11): Likewise.
> (__USE_ISOC99): Likewise.
> (__USE_ISOC95): Likewise.
> * manual/creature.texi (_ISOC2Y_SOURCE): Document.
>
> Signed-off-by: Lenard Mollenkopf<glibc@lenardmollenkopf.de>
> ---
> NEWS | 7 +++++++
> include/features.h | 23 ++++++++++++++++++-----
> manual/creature.texi | 7 +++++++
> 3 files changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 2fe0396b2d..1d048de0e6 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -31,6 +31,13 @@ Major new features:
> * The iconv program now supports converting files in place. The program
> automatically uses a temporary file if required.
>
> +* The GNU C Library now supports a feature test macro _ISOC2Y_SOURCE to
> + enable features from the draft ISO C2Y standard. Only some features from
> + this draft standard are supported by the GNU C Library, and as the draft
> + is under active development, the set of features enabled by this macro is
> + liable to change. Features from C2Y are also enabled by _GNU_SOURCE, or
> + by compiling with "gcc -std=gnu2y".
> +
> Deprecated and removed features, and other changes affecting compatibility:
>
> * The big-endian ARC port (arceb-linux-gnu) has been removed.
> diff --git a/include/features.h b/include/features.h
> index 093de6f44c..0a8aa7c4f9 100644
> --- a/include/features.h
> +++ b/include/features.h
> @@ -26,6 +26,7 @@
> _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
> _ISOC23_SOURCE Extensions to ISO C99 from ISO C23.
> _ISOC2X_SOURCE Old name for _ISOC23_SOURCE.
> + _ISOC2Y_SOURCE Extensions to ISO C23 from ISO C2Y.
> __STDC_WANT_LIB_EXT2__
> Extensions to ISO C99 from TR 27431-2:2010.
> __STDC_WANT_IEC_60559_BFP_EXT__
> @@ -150,6 +151,7 @@
> #undef __USE_FORTIFY_LEVEL
> #undef __KERNEL_STRICT_NAMES
> #undef __GLIBC_USE_ISOC23
> +#undef __GLIBC_USE_ISOC2Y
> #undef __GLIBC_USE_DEPRECATED_GETS
> #undef __GLIBC_USE_DEPRECATED_SCANF
> #undef __GLIBC_USE_C23_STRTOL
> @@ -216,6 +218,8 @@
> # define _ISOC11_SOURCE 1
> # undef _ISOC23_SOURCE
> # define _ISOC23_SOURCE 1
> +# undef _ISOC2Y_SOURCE
> +# define _ISOC2Y_SOURCE 1
> # undef _POSIX_SOURCE
> # define _POSIX_SOURCE 1
> # undef _POSIX_C_SOURCE
> @@ -239,15 +243,23 @@
> #if (defined _DEFAULT_SOURCE \
> || (!defined __STRICT_ANSI__ \
> && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \
> - && !defined _ISOC23_SOURCE \
> + && !defined _ISOC23_SOURCE && !defined _ISOC2Y_SOURCE \
> && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \
> && !defined _XOPEN_SOURCE))
> # undef _DEFAULT_SOURCE
> # define _DEFAULT_SOURCE 1
> #endif
>
> +/* This is to enable the ISO C2Y extension. */
> +#if (defined _ISOC2Y_SOURCE \
> + || (defined __STDC_VERSION__ && __STDC_VERSION__ > 202311L))
> +# define __GLIBC_USE_ISOC2Y 1
> +#else
> +# define __GLIBC_USE_ISOC2Y 0
> +#endif
> +
> /* This is to enable the ISO C23 extension. */
> -#if (defined _ISOC23_SOURCE \
> +#if (defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
> || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
> # define __GLIBC_USE_ISOC23 1
> #else
> @@ -255,21 +267,22 @@
> #endif
>
> /* This is to enable the ISO C11 extension. */
> -#if (defined _ISOC11_SOURCE || defined _ISOC23_SOURCE \
> +#if (defined _ISOC11_SOURCE || defined _ISOC23_SOURCE \
> + || defined _ISOC2Y_SOURCE \
> || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
> # define __USE_ISOC11 1
> #endif
>
> /* This is to enable the ISO C99 extension. */
> #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
> - || defined _ISOC23_SOURCE \
> + || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
> || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
> # define __USE_ISOC99 1
> #endif
>
> /* This is to enable the ISO C90 Amendment 1:1995 extension. */
> #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
> - || defined _ISOC23_SOURCE \
> + || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
> || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
> # define __USE_ISOC95 1
> #endif
> diff --git a/manual/creature.texi b/manual/creature.texi
> index be0a5ac7e6..09e1c9670f 100644
> --- a/manual/creature.texi
> +++ b/manual/creature.texi
> @@ -233,6 +233,13 @@ Only some features from this draft standard are supported by
> @theglibc{}. The older name @code{_ISOC2X_SOURCE} is also supported.
> @end defvr
>
> +@defvr Macro _ISOC2Y_SOURCE
> +@standards{C2Y, (none)}
> +If this macro is defined, ISO C2Y extensions to ISO C23 are included.
> +Only some features from this draft standard are supported by
> +@theglibc{}.
> +@end defvr
> +
> @defvr Macro __STDC_WANT_LIB_EXT2__
> @standards{ISO, (none)}
> If you define this macro to the value @code{1}, features from ISO/IEC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20241101/0a111c09/attachment.htm>
More information about the Libc-alpha
mailing list