Re: Avoiding "unused variable" warnings

Jeff Garzik (jgarzik@pobox.com)
Sun, 13 Jul 2003 11:46:43 -0400


Andrey Borzenkov wrote:
> I think I have seen it somewhere but forgot.
>
> Is it possible to create a noop macro that makes compiler believe macro
> arguments are used? I mean the case of debug macro that for debug off is
> redefined as something like do { } while(0) but then if arguments are used
> for debugging purposes only compiler emits warning. Some people do not like
> it :)

No need for a macro, just do

(void) var_name;

It doesn't generate any code, and it shuts up the compiler.

Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/