Patchwork Fix PR51806

login
register
mail settings
Submitter Richard Guenther
Date Jan. 10, 2012, 12:25 p.m.
Message ID <alpine.LNX.2.00.1201101323440.4999@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/135221/
State New
Headers show

Comments

Richard Guenther - Jan. 10, 2012, 12:25 p.m.
This fixes LTO not honoring -Werror (similar for all other
non-C-family frontends), despite handling -Werror= just fine.
The issue is that the diagnostic context is only adjusted from
the c-family handle-options routine, not from the common
one (which does process -Werror= though).

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2012-01-10  Richard Guenther  <rguenther@suse.de>

	PR middle-end/51806
	c-family/
	* c-opts.c (c_common_handle_option): Move -Werror handling
	to language independent code.

	* opts.c (common_handle_option): Handle -Werror.
Joseph S. Myers - Jan. 10, 2012, 4 p.m.
On Tue, 10 Jan 2012, Richard Guenther wrote:

> This fixes LTO not honoring -Werror (similar for all other
> non-C-family frontends), despite handling -Werror= just fine.
> The issue is that the diagnostic context is only adjusted from
> the c-family handle-options routine, not from the common
> one (which does process -Werror= though).
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

OK.

Patch

Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 183054)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -449,10 +449,6 @@  c_common_handle_option (size_t scode, co
       cpp_opts->warn_endif_labels = value;
       break;
 
-    case OPT_Werror:
-      global_dc->warning_as_error_requested = value;
-      break;
-
     case OPT_Wformat:
       set_Wformat (value);
       break;
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 183054)
+++ gcc/opts.c	(working copy)
@@ -1420,6 +1420,10 @@  common_handle_option (struct gcc_options
       /* Currently handled in a prescan.  */
       break;
 
+    case OPT_Werror:
+      dc->warning_as_error_requested = value;
+      break;
+
     case OPT_Werror_:
       if (lang_mask == CL_DRIVER)
 	break;