This is the mail archive of the gcc-patches@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: -Wunused-macros


 > From: Neil Booth <neil at daikokuya dot co dot uk> 
 > 
 > > One question: will we get warnings for cases where
 > > a macro is only used in a conditionally compiled piece of
 > > code for which the condition is false?
 > > E.g.
 > > 
 > > 	#define FOO ...
 > > 
 > > 	#ifndef __GNUC__
 > > 	   ... FOO ...
 > > 	#endif
 > 
 > This macro will be reported as unused.  I actually think that's a
 > good idea - it encourages making the definition conditional along
 > with the code that uses it.  Do you agree?
 > There are some cases of this in GCC; but I've ignored them so
 > far.

I think the new feature is useful in general, however I'm worried
people on one platform where a macro isn't used may erroneously delete
the definition and accidentally hose other platforms.  This is very
easy in gcc sources have so many conditional things depending on the
target.

This seems more likely to me with the other feature you hinted at, for
supposendly "unused" headers.

Is there some way to address this potential problem?


 > > > I've not added it to -Wunused, since -Wall implies -Wunused,
 > > > and I think this option may be too pricey to go there.
 > 
 > There is quite a bit of noise in YACC-generated files because they
 > tend to define 10 or 20 macros that aren't used.
 > Neil.

Warning noise is a problem we should avoid.  If we can't silence them
then I would rather not put these in -Wall.

		--Kaveh
--
Kaveh R. Ghazi			Director of Systems Architecture
ghazi@caip.rutgers.edu		Qwest Solutions


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