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

Kenneth Graunke kenneth at whitecape.org
Mon Jun 24 20:37:32 PDT 2013


On 06/24/2013 01:22 PM, Ian Romanick wrote:
> 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.

Or just (void) deref;

I don't have a preference...either of those three approaches would get:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>



More information about the mesa-dev mailing list