[Mesa-dev] [PATCH v2 29/29] gallium/aux/util/u_tests.c: Fix warnigns triggered -Wmissing-field-initializers

Gert Wollny gw.fossdev at gmail.com
Thu Nov 16 21:15:34 UTC 2017


Am Donnerstag, den 16.11.2017, 16:34 +0000 schrieb Emil Velikov:
> On 16 November 2017 at 15:10, Gert Wollny <gw.fossdev at gmail.com>
> wrote:
> > * Use a designated initializer to silence the warning.
> > * fix one intention that was using tabs instead of spaces
> > 
> 
> Sigh, -Wmissing-field-initalizers warnings - it's perhaps the most
> annoying and inconsistent warning I've seen :-(
> 
> Originally the whole struct is initialised while now only a single
> component. Hence these changes are likely to introduce subtle bugs -
> today or X days down the line.

I see, I was already kind of reluctant to add this with the first first
version of the series. Probably it is the best to drop that patch for
now and think of something else to deal with this warning.

(Running things with valgrind should catch this though.) 

thanks for your insight, 
Gert 


> 
> > @@ -93,7 +93,7 @@ util_set_blend_normal(struct cso_context *cso)
> >  static void
> >  util_set_dsa_disable(struct cso_context *cso)
> >  {
> > -   struct pipe_depth_stencil_alpha_state dsa = {{0}};
> > +   struct pipe_depth_stencil_alpha_state dsa = {.depth = {0}};
> > 
> >     cso_set_depth_stencil_alpha(cso, &dsa);
> 
> In this case - cso_set_depth_stencil_alpha() treats dsa as const ...
> So if further down the function anything other than .depth is read
> things are will end badly.
> 
> -Emil


More information about the mesa-dev mailing list