flags.h (extra_warnings): Delete.

2009-05-03  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* flags.h (extra_warnings): Delete.
	* toplev.c (process_options): Handle Wuninitialized here.
	* opts.c (extra_warnings): Delete.
	(set_Wextra): Delete.
	(common_handle_option): -Wextra can be handled automatically.
	* c-opts.c (c_common_handle_option): Delete obsolete code.
	(c_common_post_options): Simplify comment.
	* common.opt (W): Add Var.
	(Wextra): Add Var.
	(Wuninitialized): Initialize to -1.

From-SVN: r147080
parent 8c7926c4
2009-05-03 Manuel López-Ibáñez <manu@gcc.gnu.org>
* flags.h (extra_warnings): Delete.
* toplev.c (process_options): Handle Wuninitialized here.
* opts.c (extra_warnings): Delete.
(set_Wextra): Delete.
(common_handle_option): -Wextra can be handled automatically.
* c-opts.c (c_common_handle_option): Delete obsolete code.
(c_common_post_options): Simplify comment.
* common.opt (W): Add Var.
(Wextra): Add Var.
(Wuninitialized): Initialize to -1.
2009-05-03 Adam Nemet <anemet@caviumnetworks.com> 2009-05-03 Adam Nemet <anemet@caviumnetworks.com>
Richard Guenther <rguenther@suse.de> Richard Guenther <rguenther@suse.de>
......
...@@ -400,11 +400,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -400,11 +400,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
headers. */ headers. */
warn_unknown_pragmas = value; warn_unknown_pragmas = value;
/* We save the value of warn_uninitialized, since if they put warn_uninitialized = value;
-Wuninitialized on the command line, we need to generate a
warning about not using it without also specifying -O. */
if (warn_uninitialized != 1)
warn_uninitialized = (value ? 2 : 0);
if (!c_dialect_cxx ()) if (!c_dialect_cxx ())
{ {
...@@ -1057,11 +1053,8 @@ c_common_post_options (const char **pfilename) ...@@ -1057,11 +1053,8 @@ c_common_post_options (const char **pfilename)
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions) if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
flag_exceptions = 1; flag_exceptions = 1;
/* -Wextra implies -Wtype-limits, -Wclobbered, /* -Wextra implies the following flags
-Wempty-body, -Wsign-compare, unless explicitly overridden. */
-Wmissing-field-initializers, -Wmissing-parameter-type
-Wold-style-declaration, -Woverride-init and -Wignored-qualifiers
but not if explicitly overridden. */
if (warn_type_limits == -1) if (warn_type_limits == -1)
warn_type_limits = extra_warnings; warn_type_limits = extra_warnings;
if (warn_clobbered == -1) if (warn_clobbered == -1)
......
...@@ -70,7 +70,7 @@ Common Optimization ...@@ -70,7 +70,7 @@ Common Optimization
Optimize for space rather than speed Optimize for space rather than speed
W W
Common RejectNegative Common RejectNegative Var(extra_warnings) Warning
This switch is deprecated; use -Wextra instead This switch is deprecated; use -Wextra instead
Waggregate-return Waggregate-return
...@@ -106,7 +106,7 @@ Common Joined ...@@ -106,7 +106,7 @@ Common Joined
Treat specified warning as error Treat specified warning as error
Wextra Wextra
Common Warning Common Var(extra_warnings) Warning
Print extra (possibly unwanted) warnings Print extra (possibly unwanted) warnings
Wfatal-errors Wfatal-errors
...@@ -197,7 +197,7 @@ Common Var(warn_type_limits) Init(-1) Warning ...@@ -197,7 +197,7 @@ Common Var(warn_type_limits) Init(-1) Warning
Warn if a comparison is always true or always false due to the limited range of the data type Warn if a comparison is always true or always false due to the limited range of the data type
Wuninitialized Wuninitialized
Common Var(warn_uninitialized) Warning Common Var(warn_uninitialized) Init(-1) Warning
Warn about uninitialized automatic variables Warn about uninitialized automatic variables
Wunreachable-code Wunreachable-code
......
...@@ -111,11 +111,6 @@ extern int optimize; ...@@ -111,11 +111,6 @@ extern int optimize;
extern int optimize_size; extern int optimize_size;
/* Do print extra warnings (such as for uninitialized variables).
-W/-Wextra. */
extern bool extra_warnings;
/* Used to set the level of -Wstrict-aliasing, when no level is specified. /* Used to set the level of -Wstrict-aliasing, when no level is specified.
The external way to set the default level is to use The external way to set the default level is to use
-Wstrict-aliasing=level. -Wstrict-aliasing=level.
......
...@@ -54,9 +54,6 @@ bool sel_sched_switch_set; ...@@ -54,9 +54,6 @@ bool sel_sched_switch_set;
/* True if we should exit after parsing options. */ /* True if we should exit after parsing options. */
bool exit_after_options; bool exit_after_options;
/* Print various extra warnings. -W/-Wextra. */
bool extra_warnings;
/* True to warn about any objects definitions whose size is larger /* True to warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned than N bytes. Also want about function definitions whose returned
values are larger than N bytes, where N is `larger_than_size'. */ values are larger than N bytes, where N is `larger_than_size'. */
...@@ -372,7 +369,6 @@ unsigned num_in_fnames; ...@@ -372,7 +369,6 @@ unsigned num_in_fnames;
static int common_handle_option (size_t scode, const char *arg, int value, static int common_handle_option (size_t scode, const char *arg, int value,
unsigned int lang_mask); unsigned int lang_mask);
static void handle_param (const char *); static void handle_param (const char *);
static void set_Wextra (int);
static unsigned int handle_option (const char **argv, unsigned int lang_mask); static unsigned int handle_option (const char **argv, unsigned int lang_mask);
static char *write_langs (unsigned int lang_mask); static char *write_langs (unsigned int lang_mask);
static void complain_wrong_lang (const char *, const struct cl_option *, static void complain_wrong_lang (const char *, const struct cl_option *,
...@@ -1572,19 +1568,10 @@ common_handle_option (size_t scode, const char *arg, int value, ...@@ -1572,19 +1568,10 @@ common_handle_option (size_t scode, const char *arg, int value,
/* Currently handled in a prescan. */ /* Currently handled in a prescan. */
break; break;
case OPT_W:
/* For backward compatibility, -W is the same as -Wextra. */
set_Wextra (value);
break;
case OPT_Werror_: case OPT_Werror_:
enable_warning_as_error (arg, value, lang_mask); enable_warning_as_error (arg, value, lang_mask);
break; break;
case OPT_Wextra:
set_Wextra (value);
break;
case OPT_Wlarger_than_: case OPT_Wlarger_than_:
/* This form corresponds to -Wlarger-than-. /* This form corresponds to -Wlarger-than-.
Kept for backward compatibility. Kept for backward compatibility.
...@@ -2101,21 +2088,6 @@ handle_param (const char *carg) ...@@ -2101,21 +2088,6 @@ handle_param (const char *carg)
free (arg); free (arg);
} }
/* Handle -W and -Wextra. */
static void
set_Wextra (int setting)
{
extra_warnings = setting;
/* We save the value of warn_uninitialized, since if they put
-Wuninitialized on the command line, we need to generate a
warning about not using it without also specifying -O. */
if (setting == 0)
warn_uninitialized = 0;
else if (warn_uninitialized != 1)
warn_uninitialized = 2;
}
/* Used to set the level of strict aliasing warnings, /* Used to set the level of strict aliasing warnings,
when no level is specified (i.e., when -Wstrict-aliasing, and not when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given). -Wstrict-aliasing=level was given).
......
...@@ -1688,6 +1688,10 @@ process_options (void) ...@@ -1688,6 +1688,10 @@ process_options (void)
if (warn_unused_value == -1) if (warn_unused_value == -1)
warn_unused_value = warn_unused; warn_unused_value = warn_unused;
/* This replaces set_Wextra. */
if (warn_uninitialized == -1)
warn_uninitialized = extra_warnings;
/* Allow the front end to perform consistency checks and do further /* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c) sets the original filename if appropriate (e.g. foo.i -> foo.c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment