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: GCC warnings for unused global variables


On Thu, May 01, 2003 at 09:47:57AM -0700, Richard Henderson wrote:
> On Thu, May 01, 2003 at 09:38:13AM -0700, Joe Buck wrote:
> > > Then you'll have to ignore the warning.
> > 
> > Then we should take OUT the bleeping warning.  It wasn't there before.
> > It is a regression.
> 
> It is not a regression.  I said "ignore" because he also said
> "he couldn't modify the source".  The REAL way to get rid of 
> the warning is to mark the thing __attribute__((unused)).
> 
> Or even better, __attribute__((used)).  If he fails to do this,
> then at some point GCC will stop emitting that variable to the
> object file entirely, precisely because it isn't used.

Neither will suffice, because neither are C.  You're forgetting that GCC
is not the only C compiler in the world.  As for your last point, we
would then need to add some flag to prevent GCC from suppressing the
emission of unused static objects.  It would be more acceptable to ask
people to add a new flag than to ask them to change all of their old
code bases (I believe you are, in effect, asking the BSD folks to change
*every single file* in their operating system, or else live with vast
numbers of warnings), but it's better still not to require any change.
 
> This would be considered a feature for any other variable,
> and I can't stomach making bletcherous special cases for a 
> variable named "rcsid".

I agree that there should be no special cases based on variable names.
-- 
Q. What's more of a headache than a bug in a compiler.
A. Bugs in six compilers.  -- Mark Johnson


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