Mesa (master): nir: use braces around subobject in initializer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 26 19:02:42 UTC 2019


Module: Mesa
Branch: master
Commit: 7a7f182dac0b8f29f83a2eca02d29f10e8b23244
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a7f182dac0b8f29f83a2eca02d29f10e8b23244

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Apr 23 14:35:17 2019 +0300

nir: use braces around subobject in initializer

Used same syntax as elsewhere with Mesa sources, verified result
against MSVC with godbolt.org.

fixes following warning with clang:
   warning: suggest braces around initialization of subobject

v2: empty braces -> braces around subobject (Caio, Kristian)

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>

---

 src/compiler/nir/nir_linking_helpers.c    | 4 ++--
 src/compiler/nir/nir_lower_io_to_vector.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index ef0f94baf47..faf8a1eaced 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -476,7 +476,7 @@ gather_varying_component_info(nir_shader *consumer,
                               unsigned *varying_comp_info_size,
                               bool default_to_smooth_interp)
 {
-   unsigned store_varying_info_idx[MAX_VARYINGS_INCL_PATCH][4] = {0};
+   unsigned store_varying_info_idx[MAX_VARYINGS_INCL_PATCH][4] = {{0}};
    unsigned num_of_comps_to_pack = 0;
 
    /* Count the number of varying that can be packed and create a mapping
@@ -726,7 +726,7 @@ nir_compact_varyings(nir_shader *producer, nir_shader *consumer,
    assert(producer->info.stage != MESA_SHADER_FRAGMENT);
    assert(consumer->info.stage != MESA_SHADER_VERTEX);
 
-   struct assigned_comps assigned_comps[MAX_VARYINGS_INCL_PATCH] = {0};
+   struct assigned_comps assigned_comps[MAX_VARYINGS_INCL_PATCH] = {{0}};
 
    get_unmoveable_components_masks(&producer->outputs, assigned_comps,
                                    producer->info.stage,
diff --git a/src/compiler/nir/nir_lower_io_to_vector.c b/src/compiler/nir/nir_lower_io_to_vector.c
index d979962373d..abc89fb2f49 100644
--- a/src/compiler/nir/nir_lower_io_to_vector.c
+++ b/src/compiler/nir/nir_lower_io_to_vector.c
@@ -197,10 +197,10 @@ nir_lower_io_to_vector_impl(nir_function_impl *impl, nir_variable_mode modes)
    nir_metadata_require(impl, nir_metadata_dominance);
 
    nir_shader *shader = impl->function->shader;
-   nir_variable *old_inputs[MAX_VARYINGS_INCL_PATCH][4] = {0};
-   nir_variable *new_inputs[MAX_VARYINGS_INCL_PATCH][4] = {0};
-   nir_variable *old_outputs[MAX_VARYINGS_INCL_PATCH][4] = {0};
-   nir_variable *new_outputs[MAX_VARYINGS_INCL_PATCH][4] = {0};
+   nir_variable *old_inputs[MAX_VARYINGS_INCL_PATCH][4] = {{0}};
+   nir_variable *new_inputs[MAX_VARYINGS_INCL_PATCH][4] = {{0}};
+   nir_variable *old_outputs[MAX_VARYINGS_INCL_PATCH][4] = {{0}};
+   nir_variable *new_outputs[MAX_VARYINGS_INCL_PATCH][4] = {{0}};
 
    if (modes & nir_var_shader_in) {
       /* Vertex shaders support overlapping inputs.  We don't do those */




More information about the mesa-commit mailing list