https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95379

--- Comment #15 from Asher Gordon <AsDaGo at posteo dot net> ---
(In reply to Luc Van Oostenryck from comment #14)
> I've now changed Sparse's default so that these warnings are not issued
> anymore.

Thanks Luc.

(In reply to Tom Tromey from comment #7)
> The feature was added specifically to mimic what sparse does.
> If sparse changes, I think changing gcc would be appropriate.

Now there are a few things to consider: GCC currently treats '{ 0 }' specially
for -Wmissing-field-initializers (and maybe other warnings too). So if GCC adds
an option, -Wuniversal-initializer, should '-Wmissing-field-initializers
-Wuniversal-initializer' warn on '{ 0 }' (assuming that the struct being
initialized has more than one member)? Or alternatively, should
-Wdesignated-init treat '{ 0 }' specially, and no -Wuniversal-initializer
should be added?

Also, how should '{ 0, }' be treated? Sparse does not treat this specially
(i.e., it warns on '{ 0, }' with -Wdesignated-init). However, GCC does treat '{
0, }' specially (like '{ 0 }') for -Wmissing-field-initializers. Personally, I
think that Sparse's is the better behavior, since people will very rarely do '{
0, }' to mean "init to zero", and when people do use '{ 0, }', they probably
mean "init first member to zero". But I don't have a strong opinion on this,
and I don't think any special effort should be taken to avoid treating '{ 0, }'
like '{ 0 }'.

Reply via email to