[igt-dev] [PATCH i-g-t] meson: add -Wno-missing-braces

Jani Nikula jani.nikula at linux.intel.com
Wed Mar 20 12:11:16 UTC 2019


On Wed, 20 Mar 2019, "Ser, Simon" <simon.ser at intel.com> wrote:
> On Wed, 2019-03-20 at 11:38 +0200, Jani Nikula wrote:
>> On Wed, 20 Mar 2019, "Ser, Simon" <simon.ser at intel.com> wrote:
>> > Enabling -Werror=missing-braces results in this error with Clang:
>> > 
>> >     ../tests/kms_vrr.c:203:20: error: suggest braces around
>> > initialization of subobject [-Werror,-Wmissing-braces]
>> >             drmVBlank vbl = { 0 };
>> >                               ^
>> >                               {}
>> > 
>> > I don't believe there is any value in keeping this, so let's just
>> > disable it.
>> 
>> I fail to come up with examples right now, but I think there are
>> legitimate cases for the warning.
>> 
>> Arguably the above initializer should be written as simply {} instead
>> of
>> having the 0 value for initializing the first member which happens to
>> be
>> a substruct.
>
> Unfortunately using {} is a GNU extension, and ISO C forbids empty
> initializer lists.

Right, it's also okay in ISO C++11.

> Does IGT use un-standardized extensions?

I'm pretty sure it does, but I'll defer decisions about this to the IGT
maintainers.

BR,
Jani.


>
>> BR,
>> Jani.
>> 
>> 
>> > Signed-off-by: Simon Ser <simon.ser at intel.com>
>> > ---
>> >  meson.build | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > diff --git a/meson.build b/meson.build
>> > index 557400a5..bb100b75 100644
>> > --- a/meson.build
>> > +++ b/meson.build
>> > @@ -38,6 +38,7 @@ cc_args = [
>> >  	'-Wno-type-limits',
>> >  	'-Wno-unused-parameter',
>> >  	'-Wno-unused-result',
>> > +	'-Wno-missing-braces',
>> >  	'-Werror=address',
>> >  	'-Werror=array-bounds',
>> > @@ -45,7 +46,6 @@ cc_args = [
>> >  	'-Werror=init-self',
>> >  	'-Werror=int-to-pointer-cast',
>> >  	'-Werror=main',
>> > -	'-Werror=missing-braces',
>> >  	'-Werror=nonnull',
>> >  	'-Werror=pointer-to-int-cast',
>> >  	'-Werror=return-type',

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the igt-dev mailing list