[Mesa-dev] [PATCH 1/8] nir: Silence missing field initializer warnings for nir_src

Ilia Mirkin imirkin at alum.mit.edu
Mon Dec 14 15:38:59 PST 2015


It's a pretty standard feature of compilers to init things to 0 and
not have the full structure specified like that... what compiler are
you seeing these with? Can we just fix the glitch with a
-Wno-stupid-warnings?

On Mon, Dec 14, 2015 at 6:34 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> nir/nir.h: In function 'nir_src_for_ssa':
> nir/nir.h:552:4: warning: missing initializer for field 'use_link' of 'nir_src'
> [-Wmissing-field-initializers]
>     nir_src src = NIR_SRC_INIT;
>     ^
> In file included from nir/nir.c:28:0:
> nir/nir.h:508:21: note: 'use_link' declared here
>     struct list_head use_link;
>                      ^
>
> Number of total warnings in my build reduced from 2329 to 1932
> (reduction of 397).
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/glsl/nir/nir.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 2e72e66..5543c52 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -515,7 +515,7 @@ typedef struct nir_src {
>     bool is_ssa;
>  } nir_src;
>
> -#define NIR_SRC_INIT (nir_src) { { NULL } }
> +#define NIR_SRC_INIT (nir_src) { { NULL }, { NULL, NULL }, { { NULL, NULL, 0 } }, false }
>
>  #define nir_foreach_use(reg_or_ssa_def, src) \
>     list_for_each_entry(nir_src, src, &(reg_or_ssa_def)->uses, use_link)
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list