[PATCH GnuPG 1/7] common: fix -Wdiscarded-qualifiers
Werner Koch
wk at gnupg.org
Tue Feb 17 09:16:03 CET 2026
Hi!
> glibc-2.43 with -std=gnu23/-std=c23 (default in >= GCC 15) implements
> C23's const-preserving macros for stdlib functions (i.e. you pass in
> a const pointer, you get one back). Fix some resulting warnings.
That is actually a cool idea but it breaks current coding practise.
For example
> - passwd_nonce = option_value (line, "--passwd-nonce");
> + passwd_nonce = (char *) option_value (line, "--passwd-nonce");
That casting is worse than the original code. The idea of those macros
seems to be to avoid just the need for casts. Now we have them back.
To make real use of these macros I considere it better to write code
with C23 in mind. However, this breaks portability on many platforms.
There are actually other compilers than gcc and llvm. And older
platforms do not update their compilers at all.
Thanks for the patch, but I won't apply it.
Salam-Shalom,
Werner
--
The pioneers of a warless world are the youth that
refuse military service. - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 284 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20260217/b548cad2/attachment.sig>
More information about the Gnupg-devel
mailing list