Proper handling of -Werror=coverage-mismatch
authorXinliang David Li <davidxl@google.com>
Fri, 22 Apr 2011 19:11:49 +0000 (19:11 +0000)
committerXinliang David Li <davidxl@gcc.gnu.org>
Fri, 22 Apr 2011 19:11:49 +0000 (19:11 +0000)
From-SVN: r172870

gcc/ChangeLog
gcc/opts-global.c
gcc/toplev.c

index a30a78cb0cd7cc53f674730223df5546b61aa25e..b334e323170380209a88aa5b8681630dd47b36e5 100644 (file)
@@ -1,3 +1,10 @@
+2011-04-22  Xinliang David Li  <davidxl@google.com>
+
+       * toplev.c (process_options): Enable -Werror=coverage-mismatch
+       by default when -Wno-error is not specified.
+       * opts-global.c (decode_options): Remove call to
+       control_warning_options.
+
 2011-04-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/48717
index 71c428e9b6b84c9f7f2ccabe4c82197903dd2d1a..1134e3a274579a57215545ab9c4e5c6d4b960ac5 100644 (file)
@@ -310,11 +310,6 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
 
   set_default_handlers (&handlers);
 
-  /* Enable -Werror=coverage-mismatch by default.  */
-  control_warning_option (OPT_Wcoverage_mismatch, (int) DK_ERROR, true,
-                         loc, lang_mask,
-                         &handlers, opts, opts_set, dc);
-
   default_options_optimization (opts, opts_set,
                                decoded_options, decoded_options_count,
                                loc, lang_mask, &handlers, dc);
index c0f6ee3681e61e192609316a95fc639c8745049f..06014a938e5d23db34fad35e5ee77c33994b348e 100644 (file)
@@ -1600,6 +1600,15 @@ process_options (void)
       flag_omit_frame_pointer = 0;
     }
 
+  /* Enable -Werror=coverage-mismatch when -Werror and -Wno-error
+     have not been set.  */
+  if (!global_options_set.x_warnings_are_errors
+      && warn_coverage_mismatch
+      && (global_dc->classify_diagnostic[OPT_Wcoverage_mismatch] ==
+          DK_UNSPECIFIED))
+    diagnostic_classify_diagnostic (global_dc, OPT_Wcoverage_mismatch,
+                                    DK_ERROR, UNKNOWN_LOCATION);
+
   /* Save the current optimization options.  */
   optimization_default_node = build_optimization_node ();
   optimization_current_node = optimization_default_node;