[PATCH] sys/features.h: Define _ISOC2Y_SOURCE and __ISO_C_VISIBLE

Corinna Vinschen vinschen@redhat.com
Tue Oct 29 15:10:05 GMT 2024


Hi Lenard,

thanks, but... shouldn't we first redefine _ISOC2X_SOURCE to
_ISOC23_SOURCE (keeping _ISOC2X_SOURCE for backward compat),
handle __STDC_VERSION__ >= 202311L if necessary, and only then
add _ISOC2Y_SOURCE?

>From the clang user guide I take it that the differences between c23
and c2y are negligible, but that would be in the light of keeping
compatibility with gcc and glibc in terms of feature tests.

As far as _ISOC2Y_SOURCE is concerned, it's not yet supported by
glibc, either, right?  Your patch at
https://patchwork.sourceware.org/project/glibc/patch/20241022131752.15971-1-glibc@lenardmollenkopf.de/
has not been merged yet, afaics.

On Oct 29 15:34, Lenard Mollenkopf wrote:
> @@ -232,6 +237,11 @@ extern "C" {
>   *	g++ -std=c++20 or newer, or with
>   *	_ISOC2X_SOURCE.
>   *
> + * __ISO_C_VISIBLE >= 2024
> + *	ISO C2y; enabled with gcc -std=c2y or newer,
> + *	g++ -std=c++26 or newer, or with
> + *	_ISOC2y_SOURCE.
> + *
>   * __ATFILE_VISIBLE
>   *	"at" functions; enabled by default, with _ATFILE_SOURCE,
>   *	_POSIX_C_SOURCE >= 200809L, or _XOPEN_SOURCE >= 700.
> @@ -278,7 +288,10 @@ extern "C" {

In between here, if _GNU_SOURCE is defined, _ISOC2Y_SOURCE should be
defined as well.


>  #define	__GNU_VISIBLE		0
>  #endif
>  
> -#if defined(_ISOC2X_SOURCE) || \
> +#if defined(_ISOC2Y_SOURCE) || \
> +  (__STDC_VERSION__ - 0) >= 202400L || (__cplusplus - 0) >= 202400L
> +#define __ISO_C_VISIBLE		2024
> +#elif defined(_ISOC2X_SOURCE) || \
>    (__STDC_VERSION__ - 0) > 201710L || (__cplusplus - 0) >= 202002L
>  #define __ISO_C_VISIBLE		2020
>  #elif defined(_ISOC11_SOURCE) || \
> -- 
> 2.47.0

Thanks,
Corinna



More information about the Newlib mailing list