[PATCH] Fix PR51806

Richard Guenther rguenther@suse.de
Tue Jan 10 12:25:00 GMT 2012


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.

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;



More information about the Gcc-patches mailing list