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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 22, 2016 at 05:59:30PM +0000, Emil Velikov wrote:
> On 22 January 2016 at 17:50, Emil Velikov <emil.l.velikov@xxxxxxxxx> wrote:
> > On 22 January 2016 at 17:47, Ville Syrjälä
> > <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> >> On Fri, Jan 22, 2016 at 05:40:54PM +0000, Emil Velikov wrote:
> >>> On 22 January 2016 at 17:29, Ilia Mirkin <imirkin@xxxxxxxxxxxx> wrote:
> >>> > On Fri, Jan 22, 2016 at 12:18 PM, Marek Olšák <maraeo@xxxxxxxxx> wrote:
> >>> >> On Fri, Jan 22, 2016 at 6:13 PM, Emil Velikov <emil.l.velikov@xxxxxxxxx> wrote:
> >>> >>> On 21 January 2016 at 16:58, Marek Olšák <maraeo@xxxxxxxxx> wrote:
> >>> >>>> On Thu, Jan 21, 2016 at 2:09 PM, Emil Velikov <emil.l.velikov@xxxxxxxxx> wrote:
> >>> >>>>> On 21 January 2016 at 12:08, Marek Olšák <maraeo@xxxxxxxxx> wrote:
> >>> >>>>>> On Thu, Jan 21, 2016 at 11:51 AM, Emil Velikov <emil.l.velikov@xxxxxxxxx> wrote:
> >>> >>>>>>> On 18 January 2016 at 22:53, Marek Olšák <maraeo@xxxxxxxxx> wrote:
> >>> >>>>>>>> Try explaining that to people who have a compulsion to fix them or
> >>> >>>>>>>> argue about them. :) Ignore? REALLY? IGNORE???
> >>> >>>>>>>>
> >>> >>>>>>> Now that we have a few people off your back can you please point out
> >>> >>>>>>> where this triggers warnings ?
> >>> >>>>>>
> >>> >>>>>> This particular warning is trigged by {}
> >>> >>>>> As mentioned previously neither {} nor {0} trigger any warning here.
> >>> >>>>> Jani hinted that you might be using an old (buggy?) compiler which
> >>> >>>>> generates them.
> >>> >>>>> Which version of GCC are you using ? Do you mind showing the first few
> >>> >>>>> warnings ?
> >>> >>>>>
> >>> >>>>>> or any { ... } which doesn't
> >>> >>>>>> initialize all members.
> >>> >>>>>>
> >>> >>>>> Do we have any outside of intel_decode.c ? I'm failing to spot any.
> >>> >>>>
> >>> >>>> amdgpu_bo.c has 7 occurences of "= {}" and they all print the warning.
> >>> >>> With 200+ cases of memset and 40+ of "= *{ *0 *}". Any objections if I
> >>> >>> send a patch to transition to either one of these two ?
> >>> >>
> >>> >> That's up to you, but please note that I don't plan to stop using "= {}",
> >>> >> because it's the most convenient way to clear memory in a lot of
> >>> >> cases and takes only 4 bytes of text.
> >>> >
> >>> > I like {} too and think we should encourage that. I'd rather
> >>> > transition the { 0 } stuff over to {}.
> >>> >
> >>> So people feel against seeing/writing single extra character 0,
> >>> despite that the warning has helped catch actual bug ?
> >>> And now are willing to transitions 40+ cases as opposed to ~15... that
> >>> feels strange to say the least.
> >>
> >> Does the '= { 0 }' thing even work if the first member happens to be
> >> something other than an integer?
> >>
> > It does here with GCC 5.2.0 :-) Cannot comment about other compilers.
> >
> 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.

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
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.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux