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


> 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


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