[Nouveau] [PATCH 2/2] nv50/ir: fix a compiler warning with debug-only code

Ilia Mirkin imirkin at alum.mit.edu
Wed Jul 8 13:18:23 PDT 2015


I suspect the issue is actually that u_debug.h isn't included. It
defines assert to be debug_assert, which in turn is

#define debug_assert(expr) (void)(0 && (expr))

which should cause the relevant var to be seen as used.


On Wed, Jul 8, 2015 at 3:40 PM, Tobias Klausmann
<tobias.johannes.klausmann at mni.thm.de> wrote:
>
>
> On 08.07.2015 21:34, Emil Velikov wrote:
>>
>> On 8 July 2015 at 19:27, Tobias Klausmann
>> <tobias.johannes.klausmann at mni.thm.de> wrote:
>>>
>>> codegen/nv50_ir_emit_nv50.cpp: In member function
>>> ‘void nv50_ir::CodeEmitterNV50::emitLOAD(const nv50_ir::Instruction*)’:
>>> codegen/nv50_ir_emit_nv50.cpp:620:12: warning: unused variable ‘offset’
>>>   [-Wunused-variable]
>>>      int32_t offset = i->getSrc(0)->reg.data.offset;
>>>
>>> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
>>> ---
>>>   src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
>>> index 67ea6df..86b16f2 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
>>> @@ -616,8 +616,11 @@ CodeEmitterNV50::emitLoadStoreSizeCS(DataType ty)
>>>   void
>>>   CodeEmitterNV50::emitLOAD(const Instruction *i)
>>>   {
>>> -   DataFile sf = i->src(0).getFile();
>>> +#ifdef DEBUG
>>>      int32_t offset = i->getSrc(0)->reg.data.offset;
>>> +#endif
>>> +
>>
>> assert is (normally) guarded by NDEBUG. Mesa/gallium has an in-house
>> replacement, which (not 100% sure) should be fine as well.
>>
>> -Emil
>
> As far as i can see it in u_debug.h assert (debug_assert) is guarded by
> DEBUG as the above change...
>
> _______________________________________________
> Nouveau mailing list
> Nouveau at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau


More information about the Nouveau mailing list