This is the mail archive of the
mailing list for the GCC project.
Re: PATCH (head): -Wunused-static-variable
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: jkj at sco dot com
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 2 May 2003 09:03:42 -0400 (EDT)
- Subject: Re: PATCH (head): -Wunused-static-variable
- References: <006f01c31052$ca96d0b0$03419384@shrike>
> In reference to the message thread starting at
> how about the following patch. This is against the head, but I can
> easily redo this on the 3.3 branch if that is desired and someone
> can take care of the merging back to the head.
> 2003-05-01 Kean Johnston <email@example.com>
> * c-opts.c (COMMAND_LINE_OPTIONS): Add -Wunused-static-variable
> for finer grained warning control.
> * doc/invoke.texi: Document it.
> * flags.h: Declare warn_unused_static_variable.
> * toplev.c (W_options): Add it.
> (check_global_declarations): Use it.
I'd prefer this warning was controlled by -W as suggested elsewhere.
We already control warning about unused parameter variables this way,
so there is precedent for this. E.g. try compiling this snippet with
"-Wall" and again with "-W -Wall".
void foo(int a)
You'll only get the warning about unused `a' with -W added.
We should do the same with this controversial "unused" warning.
Kaveh R. Ghazi firstname.lastname@example.org