[Mesa-dev] [PATCH 1/3] glsl: fix MinGW initializer warning in ast_declarator_list::hir()

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 18 10:25:36 UTC 2016


On 17 August 2016 at 15:39, Brian Paul <brianp at vmware.com> wrote:
> We need an extra set of braces for an array inside a struct.
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index e03a6e3..abab932 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -4731,7 +4731,7 @@ ast_declarator_list::hir(exec_list *instructions,
>        if ((var->data.mode == ir_var_auto || var->data.mode == ir_var_temporary)
>            && (var->type->is_numeric() || var->type->is_boolean())
>            && state->zero_init) {
> -         const ir_constant_data data = {0};
> +         const ir_constant_data data = {{0}};
Different versions of GCC trigger warning on each one of these. The
former is the correct one according to the spec, yet memset is the
most robust (warnings free) option.

Humble suggestion: opt to the latter or expect someone to unknowingly
revert this.
-Emil


More information about the mesa-dev mailing list