]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
flags.h (extra_warnings): Delete.
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Sun, 3 May 2009 19:14:06 +0000 (19:14 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Sun, 3 May 2009 19:14:06 +0000 (19:14 +0000)
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

gcc/ChangeLog
gcc/c-opts.c
gcc/common.opt
gcc/flags.h
gcc/opts.c
gcc/toplev.c

index 8fb45c142ede8144f6fdd2615e5cb7166c70fbeb..6c0bd511220b9bf19c70ee47ed62022c04829b19 100644 (file)
@@ -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>
 
index 4dffc78f14d5abd8cdb90c24aac53a639b2adf82..967be5200a7798dcd4dbe273263e6ce679d7269e 100644 (file)
@@ -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)
index 3e1b80a7215955ad4f64e46f738f4ad3cff4501f..2d372e7ebd4251692a169deb3545604328b3d671 100644 (file)
@@ -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
index e606f601f6e09c2e4850995efe3636f2e5de7bee..42158de0015e4d02159e8f7ff3f605306305e3a0 100644 (file)
@@ -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.  
index 659c1050cf999714c4348c3d3165f3b64f4ec510..1170967b949b9760083525381f29b595f112835d 100644 (file)
@@ -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).
index f1a481cbffeda3f9df1891ab1220700bbcb9647c..952029995ac29e4acf188248f7420345a56edd98 100644 (file)
@@ -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)