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
This commit is contained in:
parent
8c7926c4c7
commit
62a67c94b7
@ -1,3 +1,16 @@
|
||||
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>
|
||||
Richard Guenther <rguenther@suse.de>
|
||||
|
||||
|
13
gcc/c-opts.c
13
gcc/c-opts.c
@ -400,11 +400,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
|
||||
headers. */
|
||||
warn_unknown_pragmas = value;
|
||||
|
||||
/* 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 (warn_uninitialized != 1)
|
||||
warn_uninitialized = (value ? 2 : 0);
|
||||
warn_uninitialized = value;
|
||||
|
||||
if (!c_dialect_cxx ())
|
||||
{
|
||||
@ -1057,11 +1053,8 @@ c_common_post_options (const char **pfilename)
|
||||
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
|
||||
flag_exceptions = 1;
|
||||
|
||||
/* -Wextra implies -Wtype-limits, -Wclobbered,
|
||||
-Wempty-body, -Wsign-compare,
|
||||
-Wmissing-field-initializers, -Wmissing-parameter-type
|
||||
-Wold-style-declaration, -Woverride-init and -Wignored-qualifiers
|
||||
but not if explicitly overridden. */
|
||||
/* -Wextra implies the following flags
|
||||
unless explicitly overridden. */
|
||||
if (warn_type_limits == -1)
|
||||
warn_type_limits = extra_warnings;
|
||||
if (warn_clobbered == -1)
|
||||
|
@ -70,7 +70,7 @@ Common Optimization
|
||||
Optimize for space rather than speed
|
||||
|
||||
W
|
||||
Common RejectNegative
|
||||
Common RejectNegative Var(extra_warnings) Warning
|
||||
This switch is deprecated; use -Wextra instead
|
||||
|
||||
Waggregate-return
|
||||
@ -106,7 +106,7 @@ Common Joined
|
||||
Treat specified warning as error
|
||||
|
||||
Wextra
|
||||
Common Warning
|
||||
Common Var(extra_warnings) Warning
|
||||
Print extra (possibly unwanted) warnings
|
||||
|
||||
Wfatal-errors
|
||||
@ -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
|
||||
|
||||
Wuninitialized
|
||||
Common Var(warn_uninitialized) Warning
|
||||
Common Var(warn_uninitialized) Init(-1) Warning
|
||||
Warn about uninitialized automatic variables
|
||||
|
||||
Wunreachable-code
|
||||
|
@ -111,11 +111,6 @@ extern int optimize;
|
||||
|
||||
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.
|
||||
The external way to set the default level is to use
|
||||
-Wstrict-aliasing=level.
|
||||
|
28
gcc/opts.c
28
gcc/opts.c
@ -54,9 +54,6 @@ bool sel_sched_switch_set;
|
||||
/* True if we should exit after parsing 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
|
||||
than N bytes. Also want about function definitions whose returned
|
||||
values are larger than N bytes, where N is `larger_than_size'. */
|
||||
@ -372,7 +369,6 @@ unsigned num_in_fnames;
|
||||
static int common_handle_option (size_t scode, const char *arg, int value,
|
||||
unsigned int lang_mask);
|
||||
static void handle_param (const char *);
|
||||
static void set_Wextra (int);
|
||||
static unsigned int handle_option (const char **argv, unsigned int lang_mask);
|
||||
static char *write_langs (unsigned int lang_mask);
|
||||
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,
|
||||
/* Currently handled in a prescan. */
|
||||
break;
|
||||
|
||||
case OPT_W:
|
||||
/* For backward compatibility, -W is the same as -Wextra. */
|
||||
set_Wextra (value);
|
||||
break;
|
||||
|
||||
case OPT_Werror_:
|
||||
enable_warning_as_error (arg, value, lang_mask);
|
||||
break;
|
||||
|
||||
case OPT_Wextra:
|
||||
set_Wextra (value);
|
||||
break;
|
||||
|
||||
case OPT_Wlarger_than_:
|
||||
/* This form corresponds to -Wlarger-than-.
|
||||
Kept for backward compatibility.
|
||||
@ -2101,21 +2088,6 @@ handle_param (const char *carg)
|
||||
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,
|
||||
when no level is specified (i.e., when -Wstrict-aliasing, and not
|
||||
-Wstrict-aliasing=level was given).
|
||||
|
@ -1688,6 +1688,10 @@ process_options (void)
|
||||
if (warn_unused_value == -1)
|
||||
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
|
||||
initialization based on the command line options. This hook also
|
||||
sets the original filename if appropriate (e.g. foo.i -> foo.c)
|
||||
|
Loading…
Reference in New Issue
Block a user