[Mesa-dev] [PATCH 5/8] nir: Silence unused parameter warnings in nir_constant_expression.c

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


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

nir/nir_constant_expressions.c:290:25: warning: unused parameter 'num_components' [-Wunused-parameter]
 evaluate_ball3(unsigned num_components, nir_const_value *_src)
                         ^
nir/nir_constant_expressions.c: In function 'evaluate_fddx':
nir/nir_constant_expressions.c:1282:57: warning: unused parameter '_src' [-Wunused-parameter]
 evaluate_fddx(unsigned num_components, nir_const_value *_src)
                                                         ^

Number of total warnings in my build reduced from 1575 to 1485
(reduction of 89).

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

diff --git a/src/glsl/nir/nir_constant_expressions.py b/src/glsl/nir/nir_constant_expressions.py
index 81dd67f..a83c12e 100644
--- a/src/glsl/nir/nir_constant_expressions.py
+++ b/src/glsl/nir/nir_constant_expressions.py
@@ -248,6 +248,16 @@ evaluate_${name}(unsigned num_components, nir_const_value *_src)
       % endfor
       };
    % endfor
+   % if op.output_size != 0 or "src" not in op.const_expr:
+
+   /* Silence compiler warnings. */
+      % if op.output_size != 0:
+   (void) num_components;
+      % endif
+      % if "src" not in op.const_expr:
+   (void) _src;
+      % endif
+   % endif
 
    % if op.output_size == 0:
       ## For per-component instructions, we need to iterate over the
-- 
2.5.0



More information about the mesa-dev mailing list