[PATCH] configure.ac: disable annoying warning -Wmissing-field-initializers

Emil Velikov emil.l.velikov at gmail.com
Fri Jan 22 11:21:31 PST 2016


On 22 January 2016 at 18:49, Ville Syrjälä
<ville.syrjala at linux.intel.com> wrote:
> On Fri, Jan 22, 2016 at 05:59:30PM +0000, Emil Velikov wrote:

>> Also let's not forget about
>>
>> a.c:17:20: warning: ISO C forbids empty initializer braces [-Wpedantic]
>>      struct foo f = {};
>>                     ^
>
> I long ago decided that -pedantic is stupid, hence I don't use it.
>
Only tried pedantic as I couldn't find any references to "= {}" in the
C spec. I'm not even remotely suggesting that we use it.

> My gcc (4.9.3 something) seems to allow the {0} but with a struct within
> a struct it angers -Wmissing-braces, although my reading of the spec
The -Wmissing-braces fix might get backported for 4.8 and 4.9 [1]

> suggests that it's pretty well defined how this sort of thing should
> behave. I was expecting some kind of 'implicit pointer from integer'
> warning when the thing it would initialize is a pointer, but didn't get
> one. Not sure why.
>
> And {} of course makes -Wmissing-field-initializers upset. I can't see
> anything in the spec to relly forbid this form, except that the syntax
> maybe doesn't allow for an empty initializer-list.
>
> About the only "useful" thing I learned from the spec is that 0 is an
> octal constant :) Makes some sense but it never occured to me before.
>
> So I guess all I can say is that gcc is stupid, and it should just stfu
> and let both '= {}' and '= {0}' through without whining about it.
>
Luckily with the 5 series things are shaping up :-)

Thanks for digging it up.
-Emil

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119


More information about the dri-devel mailing list