[Mesa-dev] [PATCH 4/4] glsl opt_flip_matrices: Silence unused variable warning in the release build

Ian Romanick idr at freedesktop.org
Mon Jun 24 13:22:26 PDT 2013


On 06/22/2013 08:43 AM, Emil Velikov wrote:
> Resolves the following gcc warning
>
>   opt_flip_matrices.cpp:84:32: warning: unused variable 'deref'
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>   src/glsl/opt_flip_matrices.cpp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/opt_flip_matrices.cpp b/src/glsl/opt_flip_matrices.cpp
> index 497513f..be3ccf8 100644
> --- a/src/glsl/opt_flip_matrices.cpp
> +++ b/src/glsl/opt_flip_matrices.cpp
> @@ -81,8 +81,8 @@ matrix_flipper::visit_enter(ir_expression *ir)
>
>      if (mvp_transpose &&
>          strcmp(mat_var->name, "gl_ModelViewProjectionMatrix") == 0) {
> -      ir_dereference_variable *deref = ir->operands[0]->as_dereference_variable();
> -      assert(deref && deref->var == mat_var);
> +      assert(ir->operands[0]->as_dereference_variable() &&
> +             ir->operands[0]->as_dereference_variable()->var == mat_var);

Rather than dipping into as_dereference_variable() twice, I'd surround 
both lines with a '#ifndef NDEBUG' block.

>
>         void *mem_ctx = ralloc_parent(ir);
>
>



More information about the mesa-dev mailing list