Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/sys



On Wed, Oct 16, 2013 at 10:03:32PM +0200, Alistair Crooks wrote:
> On Wed, Oct 16, 2013 at 03:31:43PM -0400, Christos Zoulas wrote:
> > Module Name:        src
> > Committed By:       christos
> > Date:               Wed Oct 16 19:31:43 UTC 2013
> > 
> > Modified Files:
> >     src/sys/sys: cdefs.h
> > 
> > Log Message:
> > introduce __USE(variable) that uses a variable to squash unused variable
> > warnings.
> > [...]
> >  
> > +#define __USE(a) ((void)(a))
> 
> I've long been using a macro like:
> 
> #define USE_ARG(x)     /*LINTED*/(void)&(x)

Having an official macro for this is a good idea (too bad C99 did not follow
C++ in the unnamed arguments change, so we could just comment out the name
of the unused argument in the function definition).

However, we should be carefull when using this. Applying it to variables
used only in certain #ifdef combinations is fine, as well as for function
arguments not used (but imposed by the interface).

But IMHO it would be very bad to change

        (void)GET32(sc, RADEON_DP_DATATYPE);

to

        __USE(GET32(sc, RADEON_DP_DATATYPE));


Martin


Home | Main Index | Thread Index | Old Index