aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2009-05-03 19:14:06 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2009-05-03 19:14:06 +0000
commit62a67c94b776e5d07acd247e8a68f60f2a824024 (patch)
tree6bbb72911fd2765093c16f58a6efa88fc9c6ed0a /gcc
parent8c7926c4c73c20a4097710c4ffd92d30a839c0fc (diff)
downloadgcc-62a67c94b776e5d07acd247e8a68f60f2a824024.zip
gcc-62a67c94b776e5d07acd247e8a68f60f2a824024.tar.gz
gcc-62a67c94b776e5d07acd247e8a68f60f2a824024.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/c-opts.c13
-rw-r--r--gcc/common.opt6
-rw-r--r--gcc/flags.h5
-rw-r--r--gcc/opts.c28
-rw-r--r--gcc/toplev.c4
6 files changed, 23 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8fb45c1..6c0bd51 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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>
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 4dffc78..967be52 100644
--- a/gcc/c-opts.c
+++ b/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)
diff --git a/gcc/common.opt b/gcc/common.opt
index 3e1b80a..2d372e7 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -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
diff --git a/gcc/flags.h b/gcc/flags.h
index e606f60..42158de 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -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.
diff --git a/gcc/opts.c b/gcc/opts.c
index 659c105..1170967 100644
--- a/gcc/opts.c
+++ b/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).
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f1a481c..9520299 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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)