This is the mail archive of the gcc-patches@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: PATCH (head): -Wunused-static-variable


On Thu, 1 May 2003, Kean Johnston wrote:

> 2003-05-01  Kean Johnston  <jkj@sco.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.

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
warning).

The existing -Wunused-variable is documented as

   -Wunused-variable
          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
jsm28@cam.ac.uk


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