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

Ben Batt benbatt at gmail.com
Fri Jun 9 11:52:17 CEST 2006


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:

/************ main.c **************/

#ifdef __GNUC__
   #define UNUSED __attribute__ ((__unused__))
#else
   #define UNUSED
#endif

void func(int unused_arg UNUSED) /* this would generate a warning
without UNUSED */
{
}

int main(int argc, char **argv)
{
   return 0;
}

/********** end main.c ****************/

artificer at hephaistos:~/tmp/ctest$ gcc main.c -Wunused-parameter
main.c: In function `main':
main.c:11: warning: unused parameter `argc'
main.c:11: warning: unused parameter `argv'
artificer at hephaistos:~/tmp/ctest$


More information about the Bf-committers mailing list