Subject: Re: __unused function args
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-toolchain
Date: 10/14/2006 12:11:43
On Fri, 13 Oct 2006, Valeriy E. Ushakov wrote:
> __unused function args have some problems with macros and cpp
> conditionals, b/c we don't know if given macro actualy uses the
> argument (e.g. on other platforms), and different #if branches may use
> different set of arguments.
>
> We need something like plan9 USED(x), so that macros and #if branches
> can "consume" args.
Is this a big problem? The gcc __attribute__((__unused__)) means
that "the variable is meant to be possibly unused", so it is not
wrong to set this attribute for arguments that actually are used.
(It does of course have the problem of developers forgetting to
remove the __unused when the code do not need it any longer, but
I'd guess the same could happen with the USED() macro too...)
But I find the warning silly anyway, so I'd prefer to use
-Wno-unused-parameter...
/Krister