Implement C23 const-preserving standard library macros

Frank Scheiner frank.scheiner@web.de
Fri Nov 21 14:25:11 GMT 2025


On 21.11.25 13:38, Tomáš Glozar wrote:
> pá 21. 11. 2025 v 11:50 odesílatel Frank Scheiner
> <frank.scheiner@web.de> napsal:
>>[...]
>> The question is, where this should be fixed? In glibc or in GCC?
>>
> 
> With respect to the above, it seems that GCC should be tweaked to
> compile correctly with C23. See this snippet in the commit that does a
> similar thing for a glibc header:
> 
> diff --git a/debug/tst-backtrace.h b/debug/tst-backtrace.h
> index e1c0a82777..a48ac0f4a8 100644
> --- a/debug/tst-backtrace.h
> +++ b/debug/tst-backtrace.h
> @@ -43,6 +43,6 @@ volatile int x;
>  static inline bool
>  match (const char *sym, const char *name)
>  {
> -  char *p = strchr (sym, '(');
> +  const char *p = strchr (sym, '(');
>    return p != NULL && strstr (p, name) != NULL;
>  }
> 
>  (Unless the GCC snapshot is not building with C23 and the logic is
> picked up incorrectly.)

The actual compilation commands in the build log don't have any
`-std=`, hence I'd say the build used the default, which should be
`c23` since GCC 15, according to [1].

[1]: https://gcc.gnu.org/projects/c-status.html#c23

The build log I'm referring to is attached.

Cheers,
Frank
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1-gcc.err.xz
Type: application/x-xz
Size: 83676 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251121/c9dfeb4b/attachment-0001.xz>


More information about the Libc-alpha mailing list