r600: fix warnings for missing-braces on clang
authorThomas H.P. Andersen <phomes@gmail.com>
Mon, 29 Aug 2022 23:14:07 +0000 (01:14 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 15:06:28 +0000 (15:06 +0000)
[2624/3754] Compiling C++ object src/gallium/drivers/r600/sfn/tests/libr600_test.a.p/sfn_test_shaders.cpp.o
../src/gallium/drivers/r600/sfn/tests/sfn_test_shaders.cpp:3066:27: warning: suggest braces around initialization of subobject [-Wmissing-braces]
   r600_shader_key key = {0};
                          ^
                          {}
1 warning generated.
[2711/3754] Compiling C++ object src/gallium/drivers/r600/libr600.a.p/sfn_sfn_nir_lower_64bit.cpp.o
../src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp:910:33: warning: suggest braces around initialization of subobject [-Wmissing-braces]
      nir_const_value val[4] = {0};
                                ^
                                {}
../src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp:1328:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
      nir_ssa_scalar channels[4] = { 0 };
                                     ^
                                     {}

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18307>

src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp
src/gallium/drivers/r600/sfn/tests/sfn_test_shaders.cpp

index ba68cd7..73a5468 100644 (file)
@@ -907,7 +907,7 @@ Lower64BitToVec2::lower(nir_instr *instr)
    case nir_instr_type_load_const:  {
       auto lc = nir_instr_as_load_const(instr);
       assert(lc->def.num_components < 3);
-      nir_const_value val[4] = {0};
+      nir_const_value val[4] = { { 0 } };
       for (uint i = 0; i < lc->def.num_components; ++i) {
          uint64_t v = lc->value[i].u64;
          val[0].u32 = v & 0xffffffff;
@@ -1325,7 +1325,7 @@ r600_lower_64bit_intrinsic(nir_builder *b, nir_intrinsic_instr *instr)
       b->cursor = nir_before_instr(&instr->instr);
 
       nir_ssa_def *src0 = instr->src[0].ssa;
-      nir_ssa_scalar channels[4] = { 0 };
+      nir_ssa_scalar channels[4] = { { 0 } };
       for (int i = 0; i < instr->num_components; i++)
          channels[i] = nir_get_ssa_scalar(src0, i);
 
index 5073028..1667281 100644 (file)
@@ -3063,7 +3063,7 @@ Shader *TestShader::from_string(const std::string& s)
    istringstream is(s);
    string line;
 
-   r600_shader_key key = {0};
+   r600_shader_key key = { { 0 } };
    key.ps.nr_cbufs = 1;
 
    do {