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: "Bonzini" <bonzini at gnu dot org>
- To: <gcc at gcc dot gnu dot org>
- Date: Fri, 2 May 2003 13:42:30 +0200
- Subject: Re: GCC warnings for unused global variables
> This is still the case; it's easy to suppress the warning by adding an
> appropriate attribute, or by use of 'volatile' (at least, I hope
> 'volatile' works, if not it can be fixed).
Is it possible to suppress the warning in -Wall for GCC 3.3, and put in the release
notes that it will become part of -Wall in GCC 3.4? I cannot believe (whatever wide
the use is) that an obvious optimization of removing unused statics cannot be done
because of rcsid tags only, and adding "volatile" is a solution too: to me, Geoff's
language lawyering is as convincing as Richard's back-end operation lawyering.
So my proposal is:
1) check into GCC 3.3 a patch not to show this warning unless -W (or how is it called
now) is given. Kean promised it, didn't he? Maybe it is better to make it very very
little invasive by not adding -Wunused-static-variables, and delaying it to after GCC
3.3 is released?
2) check into the release notes that the warning will be moved to -Wall in GCC 3.4. So
mankind is warned with at least a year of advance, and let's face that the fix is (more
or less) as simple as grep -rl "^static.*const.*rcsid" | perl -i -pe '!$replaced_yet &&
s/^static.*const(.*rcsid)/volatile$1/ && ($replaced_yet = 1)'.
3) if necessary, check into mainline (and maybe branch after GCC 3.3 is released?) a
patch not to show this warning for volatile variables.
Paolo