[Bf-committers] Re: Solution for suppressing "unused parameter"warnings?

Ken Hughes khughes at pacific.edu
Fri Jun 9 16:34:55 CEST 2006


Arne Schmitz wrote:
> Am Freitag, 9. Juni 2006 11:52 schrieb Ben Batt:
> 
>>Hi,
>>Just my 2 cents:
>>
>>On 5/31/06, Ken Hughes <khughes at pacific.edu> wrote:
>>
>>>But the problem is we (well, I anyway) don't want to just shut up all
>>>the warnings, but only the ones we know are OK.  We want the complaint
>>>to show up when it's an unintentional unused parameter.
>>>
>>>If there's no way to do that with msvc, oh well, but if we can do
>>>something for gcc then at least those of us using it can detect when
>>>there is a problem.
>>
>>I agree, those warnings are quite annoying. I asked about this once
>>before, but I'm pretty new to Blender development, and it didn't seem
>>like anyone else thought it was worthwhile. It'd be great to have a
>>gcc macro, and it's pretty simple:
> 
> What I usually do to indicate an unused variable is:
> 
> int f(int unused_arg)
> {
>    /* Unused arguments: */
>    (void)unused_arg;
>    ...
> }
> 
> This is valid C and C++, plus it is portable across all platforms.

This can create another warning depending on the compiler flags ("-Wall 
-Wdeclaration-after-statement -Wextra -Wno-char-subscripts"):

foo.c:4: warning: statement with no effect

:-(

Ken




More information about the Bf-committers mailing list