[PATCH v2] Silence most -Wzero-as-null-pointer-constant diagnostics

Alejandro Colomar alx@kernel.org
Wed Dec 11 23:45:57 GMT 2024


Hi Maciej,

On Wed, Dec 11, 2024 at 11:22:04PM +0000, Maciej W. Rozycki wrote:
>  They follow the structure defined in libio/bits/types/struct_FILE.h and 
> can be applied mechanically: if you have a look at the source, you'll see 
> that the order of the members does not change, but there's a shorter and a 
> longer variant (with additional members added at the end) depending on 
> _IO_USE_OLD_IO_FILE, and then the initialisers are different for the 
> `_lock' member depending on _IO_MTSAFE_IO (and trailing zero initialisers 
> are omitted except, oddly, for one, but this is ancient stuff going back a 
> quarter century to a commit titled just "Update.", so there you go).  So 
> AFAICT you can safely apply the same template change across all the 4 
> variants.

Hmmm, okay, I'll try in the following days.

>  Offhand I'm not sure if I have access to targets that use all the four 
> variants, but e.g. the o32 MIPS target uses either _IO_USE_OLD_IO_FILE or 
> !_IO_USE_OLD_IO_FILE on a per-library-object basis, so if you post a 
> patch, I can verify it for you right away, at least for compilation 
> (though I don't think my MIPS compiler will issue any relevant warnings 
> here as I'm stuck at GCC 13.2 with the MIPS targets).

Yep, I can send the patches with a big notice that I didn't test them.

> 
>  I think you can use scripts/build-many-glibcs.py for verification as well 
> (but I've never used the script myself, so I can't expect anyone to use it 
> either).

Me neither.  I once tried to look at it, but I couldn't find out how to
use it.  Maybe one day I find the time to learn how to use it, but it
won't be today.  :)

> And last but not least CI will pick up any changes posted via 
> patchwork and verify a couple of targets as well (have you seen that?).

Yep, I've seen it catch a few issues in some of my patches.  I don't
know how much it covers, so I prefer testing myself before sonding, but
yeah, it's good to have it there.

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20241212/caf3f936/attachment.sig>


More information about the Libc-alpha mailing list