[Mesa-dev] [PATCH 4/8] nir: Silence missing field initializer warnings for vectors in nir_constant_expressions

Ian Romanick idr at freedesktop.org
Mon Dec 14 15:34:28 PST 2015


From: Ian Romanick <ian.d.romanick at intel.com>

nir/nir_constant_expressions.c: In function 'evaluate_ball2':
nir/nir_constant_expressions.c:279:7: warning: missing initializer for field 'z' of 'struct bool_vec' [-Wmissing-field-initializers]
       };
       ^
nir/nir_constant_expressions.c:234:10: note: 'z' declared here
    bool z;
          ^

Number of total warnings in my build reduced from 1643 to 1574
(reduction of 69).

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/nir/nir_constant_expressions.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/glsl/nir/nir_constant_expressions.py b/src/glsl/nir/nir_constant_expressions.py
index 32784f6..81dd67f 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -239,6 +239,13 @@ evaluate_${name}(unsigned num_components, nir_const_value *_src)
             _src[${j}].${op.input_types[j][:1]}[${k}],
          % endif
       % endfor
+      % for k in range(op.input_sizes[j], 4):
+         % if op.input_types[j] == "bool":
+            false,
+         % else:
+            0,
+         % endif
+      % endfor
       };
    % endfor
 
-- 
2.5.0



More information about the mesa-dev mailing list