This is the mail archive of the
mailing list for the GCC project.
Re: PATCH (head): -Wunused-static-variable
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Kean Johnston <jkj at sco dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 May 2003 09:44:34 +0100 (BST)
- Subject: Re: PATCH (head): -Wunused-static-variable
- References: <006f01c31052$ca96d0b0$03419384@shrike>
On Thu, 1 May 2003, Kean Johnston wrote:
> 2003-05-01 Kean Johnston <firstname.lastname@example.org>
> * 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.
You need testcases for this patch - that the option works, and that -Wall
doesn't include it.
You should follow the convention of -Wunused-parameter that extra -Wunused
options get enabled if -Wextra is used (so -Wall -Wextra enables this
The existing -Wunused-variable is documented as
Warn whenever a local variable or non-constant static variable
is unused aside from its declaration
so I think this new option should be specifically for const static
variables, with nonconst ones staying in the existing option.
Joseph S. Myers