This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: [patch] cgen/opc-ibld.scm
Andrew Cagney wrote:
>
> Ben Elliston wrote:
> >
> > This small patch removes some warnings when compiling opcodes.
> >
> > In general, I'm not a fan of such annotations in the source. It detracts
> > from the readability of the program. IMHO, the compiler should be fixed to
> > emit sensible warnings instead.
>
> Er, the compiler has been fixed. The only thing left is probably to
> eliminate -Wunused-params from -Wall.
To expand,
The original -Wunused warning checked for many many things, some were
useful, some were not.
Ignoring -Wunused-parameters, the -Wunused warnings (assuming no hasty
#ifdefs :-) can be fixed by deleting unused code - QED. On the other
hand, if your code contains lots of virtual functions (like GDB),
-Wunused-parameters is pretty useless. For instance:
o user one hand codes function
doesn't use a parameter (a)
so adds ATTRIB_UNUSED
to it.
o user two changes function
so that parameter A is used
but B is not. Probably of
user remembering to remove
ATTRIB_UNUSED from A 0%.
Over time the code is going to accumulate meanginless ATTRIB_UNUSEDs. I
can't see any real benefit in doing this. One might as well just add
ATTRIB_UNUSED to all parameters or, better, be more selective and not
include that warning. :-)
Andrew