[Mesa-dev] [PATCH 5/8] nir: Silence unused parameter warnings in nir_constant_expression.c
Jason Ekstrand
jason at jlekstrand.net
Wed Dec 16 12:57:25 PST 2015
On Dec 14, 2015 3:34 PM, "Ian Romanick" <idr at freedesktop.org> wrote:
>
> 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
Can we just do the casts unconditionally at the top of the function with a
comment that some parameters may be unused. I just don't want to add
generator logic for it if we don't have to. Is that reasonable?
>
> % if op.output_size == 0:
> ## For per-component instructions, we need to iterate over the
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151216/6f1b6eb8/attachment-0001.html>
More information about the mesa-dev
mailing list