This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: GCC warnings for unused global variables
- From: "Kean Johnston" <jkj at sco dot com>
- To: "'Richard Henderson'" <rth at redhat dot com>,"'Joe Buck'" <jbuck at synopsys dot com>,"'Alexander Kabaev'" <kabaev at mail dot ru>, <pthomas at suse dot de>,<ak03 at gte dot com>, <gcc at gcc dot gnu dot org>
- Date: Thu, 1 May 2003 10:54:44 -0700
- Subject: RE: GCC warnings for unused global variables
- Organization: The SCO Group
> I should add that this has already found mistakes, both within gcc
> itself and in the linux kernel, where some static variable was left
> stranded when the bit of code it had been associated with was removed,
> but the variable forgotten.
>
> That is exactly the sort of thing I expect this feature to find.
Then by all means, let a user on a bug hunting mechanism turn on
-Wall -Wunused-static-variables. It helps those users and doesn't
hinder others. Having it part of -Wall just breaks so much its
hardly worth it.
The man page says "These are all of the options which pertain to usage
that we recommend avoiding and that we believe is easy to avoid,
even in conjunction with macros". Due to the 30-year history of
MUCH source code compiled with gcc, this warning falls very far
short of the "easy to avoid" statement. As someone pointed out,
the entire FreeBSD, NetBSD, OpenBSD, SVR3.2, SVR4.2, SVR5 source
trees, which is a *HUGE* amount of code, would all be affected
by this. I am frankly surprised you don't see that and are fighting
so hard for this to stay in -Wall.
Kean