This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Criteria for a warning to be in -Wall? (was: Re: a warning to implement)


> Joe> Many projects and development teams, both free and non-free, require
> Joe> clean compiles with -Wall.  What this means is that if we put an option
> 
> I have free code that that requires clean compiles with -Wall but also
> has to compile with other compilers.  When you have a function that has,
> say, a fixed prototype (perhaps it's the target of a function dispatch
> table) but no actual need for the arguments (maybe it's a stub function)
> the 'foo = foo' construct is the only one I've seen that generates zero
> additional opcodes, yet shuts up the warnings on all the interesting
> compilers.

Sigh.  In C++ there is standard syntax for saying that an argument is
unused.  For example, if the second argument is unused

int foo(int arg1, int)
{
	return arg1;
}

Since this goes back to cfront, I'd be very surprised to find any compiler
that doesn't support this usage.  So, at least for C++, I don't think
your argument applies.

> Tim> 2) avoidable by replacement with an equivalent construct
> 
> I'd have a strong preference for something that doesn't rely on GCC
> extension.   __attribute((unused)) is just as icky in a portable project
> as magic /* ARGSUNUSED */ comments recognized by others.

Lint-like comments go back to the origins of C and many of them are
recognized by multiple compilers.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]