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

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 16 16:34:50 UTC 2017


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.

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