This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Disentangle diagnostics from option processing


This patch removes dependencies of the diagnostics code on the
option-processing code, in accordance with the principles that:

* The option-processing code should depend on the diagnostics code,
  not the other way round (which is very helpful in providing an
  intermediate stage in sharing both between the driver and the
  compilers proper, for example).

* It should be possible to use the diagnostics code in different
  programs in the GCC distribution with completely different sets of
  options, not just in the driver and compilers proper which take
  essentially the same options, so the diagnostics code must not
  depend on any compile-time-fixed enumeration of options or fixed
  number of options.  (There's a case that the same option processing
  machinery should be usable for different sets of options in
  different programs, though making that possible is certainly beyond
  the scope of what I plan to do, and given how simple the option
  processing requirements of programs such as gcov and collect2 are it
  might be considered overkill to generalize the machinery for the
  sake of them.)

Some more globals move into the diagnostic context, as does a setting
of the option controlling permerrors to avoid hardcoded
OPT_fpermissive.  Determining whether a warning option is enabled, and
producing an option name to show in a diagnostic message, are now done
through callbacks.  To avoid forcing all users of opts.h to include
diagnostic.h first, or including diagnostic.h from opts.h, I created a
new header opts-diagnostic.h for one of these hooks.

The previous practice of setting flags in global_dc after all the
options have been processed does not work for -w; various Fortran
testcases rely on -w to disable warnings about options that are only
valid for some languages (these are testcases building both Fortran
and C code with the same options).  So I moved those settings to the
option processing code.  This use of -w is very fragile because it
relies on -w coming before the options being wanted about *after the
options passed to the driver have been reordered by specs for cc1*.
So neither -w -ff2c nor -ff2c -w (compiling C code) will warn, but
both -w -Wampersand and -Wampersand -w will warn.  My inclination is
that option ordering should not matter unless one option exactly
overrides another, so none of these four cases should warn.  In my
proposal for creating explicit options structures from command lines,
this probably means acting on diagnostics machinery options anywhere
in the command line before doing further processing that may itself
produce diagnostics.

I noticed that I'd omitted initialization of diagnostic_context fields
I added recently, so I added that in this patch.  (Since GCC only has
the global context at present - nothing initializes any other context
- and since that context is statically zero-initialized - the omission
of initialization did not cause problems.)  The previous
initialization of the classify_diagnostic field with memset was
logically incorrect, since the fields to be initialized with
DK_UNSPECIFIED are enum (typically int-size) fields, not bytes; since
DK_UNSPECIFIED is zero, this did not actually cause a problem.  I've
made it use an explicit loop (which in theory -ftree-loop-distribution
could convert back to memset, except that -ftree-loop-distribution is
not enabled at any -O level, does not have any testcases that it
actually works and I couldn't get it to convert a standalone version
of this loop to memset).

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

2010-05-26  Joseph Myers  <joseph@codesourcery.com>

	* diagnostic.c: Don't include opts.h.
	(permissive_error_option): Define.
	(diagnostic_initialize): Take n_opts parameter.  Allocate memory
	for classify_diagnostic.  Don't use memset for
	classify_diagnostic.  Initialize new and recently added fields.
	(diagnostic_classify_diagnostic): Use context->n_opts instead of
	N_OPTS.
	(diagnostic_report_diagnostic): Pass context parameter to
	diagnostic_report_warnings_p.  Use option_enabled and option_name
	hooks from context.
	(emit_diagnostic): Use permissive_error_option.
	(permerror): Likewise.
	* diagnostic.h: Don't include options.h.
	(struct diagnostic_context): Add n_opts, opt_permissive,
	inhibit_warnings, warn_system_headers, option_enabled and
	option_name fields.  Change classify_diagnostic to a pointer.
	* opts-diagnostic.h: New file.
	* opts.c: Include opts-diagnostic.h.
	(common_handle_option): Set global_dc fields for -Wfatal-errors,
	-Wsystem-headers, -fshow-column, -pedantic-errors and -w.
	(option_name): New function.
	* c-opts.c (c_common_init_options): Set global_dc->opt_permissive.
	(c_common_handle_option): Set global_dc->permissive for
	-fpermissive.
	* c-common.c (c_cpp_error): Save and restore
	global_dc->warn_system_headers, not variable warn_system_headers.
	* toplev.c: Include opts-diagnostic.h.
	(general_init): Update call to diagnostic_initialize.  Set
	global_dc->show_column, global_dc->option_enabled and
	global_dc->option_name.
	(process_options): Don't set global_dc fields here.
	* Makefile.in (DIAGNOSTIC_H): Remove options.h.
	(diagnostic.o, opts.o, toplev.o): Update dependencies.

fortran:
2010-05-26  Joseph Myers  <joseph@codesourcery.com>

	* cpp.c (cb_cpp_error): Save and restore
	global_dc->warn_system_headers, not variable warn_system_headers.

Index: opts-diagnostic.h
===================================================================
--- opts-diagnostic.h	(revision 0)
+++ opts-diagnostic.h	(revision 0)
@@ -0,0 +1,25 @@
+/* Command line option handling.  Interactions with diagnostics code.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_OPTS_DIAGNOSTIC_H
+#define GCC_OPTS_DIAGNOSTIC_H
+
+extern char *option_name (diagnostic_context *context, int option_index,
+			  diagnostic_t orig_diag_kind, diagnostic_t diag_kind);
+#endif
Index: diagnostic.c
===================================================================
--- diagnostic.c	(revision 159828)
+++ diagnostic.c	(working copy)
@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3.  
 #include "toplev.h"
 #include "intl.h"
 #include "diagnostic.h"
-#include "opts.h"
 
 #define pedantic_warning_kind(DC)			\
   ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
 #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
+#define permissive_error_option(DC) ((DC)->opt_permissive)
 
 /* Prototypes.  */
 static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
@@ -77,8 +77,10 @@ file_name_as_prefix (const char *f)
 
 /* Initialize the diagnostic message outputting machinery.  */
 void
-diagnostic_initialize (diagnostic_context *context)
+diagnostic_initialize (diagnostic_context *context, int n_opts)
 {
+  int i;
+
   /* Allocate a basic pretty-printer.  Clients will replace this a
      much more elaborated pretty-printer if they wish.  */
   context->printer = XNEW (pretty_printer);
@@ -91,13 +93,24 @@ diagnostic_initialize (diagnostic_contex
   memset (context->diagnostic_count, 0, sizeof context->diagnostic_count);
   context->some_warnings_are_errors = false;
   context->warning_as_error_requested = false;
-  memset (context->classify_diagnostic, DK_UNSPECIFIED,
-	  sizeof context->classify_diagnostic);
+  context->n_opts = n_opts;
+  context->classify_diagnostic = XNEWVEC (diagnostic_t, n_opts);
+  for (i = 0; i < n_opts; i++)
+    context->classify_diagnostic[i] = DK_UNSPECIFIED;
   context->show_option_requested = false;
   context->abort_on_error = false;
+  context->show_column = false;
+  context->pedantic_errors = false;
+  context->permissive = false;
+  context->opt_permissive = 0;
+  context->fatal_errors = false;
+  context->inhibit_warnings = false;
+  context->warn_system_headers = false;
   context->internal_error = NULL;
   diagnostic_starter (context) = default_diagnostic_starter;
   diagnostic_finalizer (context) = default_diagnostic_finalizer;
+  context->option_enabled = NULL;
+  context->option_name = NULL;
   context->last_module = 0;
   context->x_data = NULL;
   context->lock = 0;
@@ -295,7 +308,7 @@ diagnostic_classify_diagnostic (diagnost
   diagnostic_t old_kind;
 
   if (option_index <= 0
-      || option_index >= N_OPTS
+      || option_index >= context->n_opts
       || new_kind >= DK_LAST_DIAGNOSTIC_KIND)
     return DK_UNSPECIFIED;
 
@@ -322,7 +335,7 @@ diagnostic_report_diagnostic (diagnostic
   /* Give preference to being able to inhibit warnings, before they
      get reclassified to something else.  */
   if ((diagnostic->kind == DK_WARNING || diagnostic->kind == DK_PEDWARN)
-      && !diagnostic_report_warnings_p (location))
+      && !diagnostic_report_warnings_p (context, location))
     return false;
 
   if (diagnostic->kind == DK_PEDWARN)
@@ -360,7 +373,7 @@ diagnostic_report_diagnostic (diagnostic
     {
       /* This tests if the user provided the appropriate -Wfoo or
 	 -Wno-foo option.  */
-      if (! option_enabled (diagnostic->option_index))
+      if (! context->option_enabled (diagnostic->option_index))
 	return false;
       /* This tests if the user provided the appropriate -Werror=foo
 	 option.  */
@@ -405,38 +418,20 @@ diagnostic_report_diagnostic (diagnostic
   saved_format_spec = diagnostic->message.format_spec;
   if (context->show_option_requested)
     {
-      const char * option_text = NULL;
+      char *option_text;
 
-      if (diagnostic->option_index)
-	{
-	  /* A warning classified as an error.  */
-	  if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN)
-	      && diagnostic->kind == DK_ERROR)
-	    option_text 
-	      = ACONCAT ((cl_options[OPT_Werror_].opt_text,
-			  /* Skip over "-W".  */
-			  cl_options[diagnostic->option_index].opt_text + 2,
-			  NULL));
-	  /* A warning with option.  */
-	  else
-	    option_text = cl_options[diagnostic->option_index].opt_text;
-	}
-      /* A warning without option classified as an error.  */
-      else if (orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN
-	       || diagnostic->kind == DK_WARNING)
-	{
-	  if (context->warning_as_error_requested)
-	    option_text = cl_options[OPT_Werror].opt_text;
-	  else
-	    option_text = _("enabled by default");
-	}
+      option_text = context->option_name (context, diagnostic->option_index,
+					  orig_diag_kind, diagnostic->kind);
 
       if (option_text)
-	diagnostic->message.format_spec
-	  = ACONCAT ((diagnostic->message.format_spec,
-		      " ", 
-		      "[", option_text, "]",
-		      NULL));
+	{
+	  diagnostic->message.format_spec
+	    = ACONCAT ((diagnostic->message.format_spec,
+			" ", 
+			"[", option_text, "]",
+			NULL));
+	  free (option_text);
+	}
     }
   diagnostic->message.locus = &diagnostic->location;
   diagnostic->message.x_data = &diagnostic->x_data;
@@ -519,7 +514,7 @@ emit_diagnostic (diagnostic_t kind, loca
     {
       diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
 			   permissive_error_kind (global_dc));
-      diagnostic.option_index = OPT_fpermissive;
+      diagnostic.option_index = permissive_error_option (global_dc);
     }
   else {
       diagnostic_set_info (&diagnostic, gmsgid, &ap, location, kind);
@@ -638,7 +633,7 @@ permerror (location_t location, const ch
   va_start (ap, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
                        permissive_error_kind (global_dc));
-  diagnostic.option_index = OPT_fpermissive;
+  diagnostic.option_index = permissive_error_option (global_dc);
   va_end (ap);
   return report_diagnostic (&diagnostic);
 }
Index: diagnostic.h
===================================================================
--- diagnostic.h	(revision 159828)
+++ diagnostic.h	(working copy)
@@ -23,7 +23,6 @@ along with GCC; see the file COPYING3.  
 #define GCC_DIAGNOSTIC_H
 
 #include "pretty-print.h"
-#include "options.h"
 
 /* Constants used to discriminate diagnostics.  */
 typedef enum
@@ -73,12 +72,17 @@ struct diagnostic_context
   /* True if it has been requested that warnings be treated as errors.  */
   bool warning_as_error_requested;
 
-  /* For each option index that can be passed to warning() et all
-     (OPT_* from options.h), this array may contain a new kind that
-     the diagnostic should be changed to before reporting, or
-     DK_UNSPECIFIED to leave it as the reported kind, or DK_IGNORED to
-     not report it at all.  N_OPTS is from <options.h>.  */
-  diagnostic_t classify_diagnostic[N_OPTS];
+  /* The number of option indexes that can be passed to warning() et
+     al.  */
+  int n_opts;
+
+  /* For each option index that can be passed to warning() et al
+     (OPT_* from options.h when using this code with the core GCC
+     options), this array may contain a new kind that the diagnostic
+     should be changed to before reporting, or DK_UNSPECIFIED to leave
+     it as the reported kind, or DK_IGNORED to not report it at
+     all.  */
+  diagnostic_t *classify_diagnostic;
 
   /* True if we should print the command line option which controls
      each diagnostic, if known.  */
@@ -96,9 +100,19 @@ struct diagnostic_context
   /* True if permerrors are warnings.  */
   bool permissive;
 
+  /* The index of the option to associate with turning permerrors into
+     warnings.  */
+  int opt_permissive;
+
   /* True if errors are fatal.  */
   bool fatal_errors;
 
+  /* True if all warnings should be disabled.  */
+  bool inhibit_warnings;
+
+  /* True if warnings should be given in system headers.  */
+  bool warn_system_headers;
+
   /* This function is called before any message is printed out.  It is
      responsible for preparing message prefix and such.  For example, it
      might say:
@@ -114,6 +128,18 @@ struct diagnostic_context
   /* Client hook to report an internal error.  */
   void (*internal_error) (diagnostic_context *, const char *, va_list *);
 
+  /* Client hook to say whether the option controlling a diagnostic is
+     enabled.  Returns nonzero if enabled, zero if disabled.  */
+  int (*option_enabled) (int);
+
+  /* Client hook to return the name of an option that controls a
+     diagnostic.  Returns malloced memory.  The first diagnostic_t
+     argument is the kind of diagnostic before any reclassification
+     (of warnings as errors, etc.); the second is the kind after any
+     reclassification.  May return NULL if no name is to be printed.
+     May be passed 0 as well as the index of a particular option.  */
+  char *(*option_name) (diagnostic_context *, int, diagnostic_t, diagnostic_t);
+
   /* Auxiliary data for client.  */
   void *x_data;
 
@@ -187,9 +213,9 @@ extern diagnostic_context *global_dc;
 #define sorrycount diagnostic_kind_count (global_dc, DK_SORRY)
 
 /* Returns nonzero if warnings should be emitted.  */
-#define diagnostic_report_warnings_p(LOC)			\
-  (!inhibit_warnings					\
-   && !(in_system_header_at (LOC) && !warn_system_headers))
+#define diagnostic_report_warnings_p(DC, LOC)				\
+  (!(DC)->inhibit_warnings						\
+   && !(in_system_header_at (LOC) && !(DC)->warn_system_headers))
 
 #define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
 
@@ -203,7 +229,7 @@ extern diagnostic_context *global_dc;
     ((DI)->option_index = (OPTIDX))
 
 /* Diagnostic related functions.  */
-extern void diagnostic_initialize (diagnostic_context *);
+extern void diagnostic_initialize (diagnostic_context *, int);
 extern void diagnostic_finish (diagnostic_context *);
 extern void diagnostic_report_current_module (diagnostic_context *);
 
Index: toplev.c
===================================================================
--- toplev.c	(revision 159828)
+++ toplev.c	(working copy)
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3.  
 #include "hosthooks.h"
 #include "cgraph.h"
 #include "opts.h"
+#include "opts-diagnostic.h"
 #include "coverage.h"
 #include "value-prof.h"
 #include "alloc-pool.h"
@@ -1691,13 +1692,16 @@ general_init (const char *argv0)
 
   /* Initialize the diagnostics reporting machinery, so option parsing
      can give warnings and errors.  */
-  diagnostic_initialize (global_dc);
+  diagnostic_initialize (global_dc, N_OPTS);
   diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
   /* Set a default printer.  Language specific initializations will
      override it later.  */
   pp_format_decoder (global_dc->printer) = &default_tree_printer;
   global_dc->show_option_requested = flag_diagnostics_show_option;
+  global_dc->show_column = flag_show_column;
   global_dc->internal_error = plugins_internal_error_function;
+  global_dc->option_enabled = option_enabled;
+  global_dc->option_name = option_name;
 
   /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages.  */
 #ifdef SIGSEGV
@@ -1828,11 +1832,6 @@ process_options (void)
   if (flag_compare_debug) 
     diagnostic_inhibit_notes (global_dc);
 
-  global_dc->show_column = flag_show_column;
-  global_dc->pedantic_errors = flag_pedantic_errors;
-  global_dc->permissive = flag_permissive;
-  global_dc->fatal_errors = flag_fatal_errors;
-
   if (flag_section_anchors && !target_supports_section_anchors_p ())
     {
       warning (OPT_fsection_anchors,
Index: opts.c
===================================================================
--- opts.c	(revision 159828)
+++ opts.c	(working copy)
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3.  
 #include "toplev.h"
 #include "params.h"
 #include "diagnostic.h"
+#include "opts-diagnostic.h"
 #include "tm_p.h"		/* For OPTIMIZATION_OPTIONS.  */
 #include "insn-attr.h"		/* For INSN_SCHEDULING.  */
 #include "target.h"
@@ -1703,6 +1704,10 @@ common_handle_option (size_t scode, cons
       warn_larger_than = value != -1;
       break;
 
+    case OPT_Wfatal_errors:
+      global_dc->fatal_errors = value;
+      break;
+
     case OPT_Wframe_larger_than_:
       frame_larger_than_size = value;
       warn_frame_larger_than = value != -1;
@@ -1726,6 +1731,10 @@ common_handle_option (size_t scode, cons
       warn_strict_overflow = value;
       break;
 
+    case OPT_Wsystem_headers:
+      global_dc->warn_system_headers = value;
+      break;
+
     case OPT_Wunused:
       warn_unused = value;
       break;
@@ -1955,6 +1964,10 @@ common_handle_option (size_t scode, cons
       flag_profile_values_set = true;
       break;
 
+    case OPT_fshow_column:
+      global_dc->show_column = value;
+      break;
+
     case OPT_fvisibility_:
       {
         if (!strcmp(arg, "default"))
@@ -2168,13 +2181,17 @@ common_handle_option (size_t scode, cons
       break;
 
     case OPT_pedantic_errors:
-      flag_pedantic_errors = pedantic = 1;
+      global_dc->pedantic_errors = flag_pedantic_errors = pedantic = 1;
       break;
 
     case OPT_fwhopr:
       flag_whopr = value;
       break;
 
+    case OPT_w:
+      global_dc->inhibit_warnings = true;
+      break;
+
     case OPT_fsee:
     case OPT_fcse_skip_blocks:
     case OPT_floop_optimize:
@@ -2510,3 +2527,38 @@ enable_warning_as_error (const char *arg
     }
   free (new_option);
 }
+
+/* Return malloced memory for the name of the option OPTION_INDEX
+   which enabled a diagnostic (context CONTEXT), originally of type
+   ORIG_DIAG_KIND but possibly converted to DIAG_KIND by options such
+   as -Werror.  */
+
+char *
+option_name (diagnostic_context *context, int option_index,
+	     diagnostic_t orig_diag_kind, diagnostic_t diag_kind)
+{
+  if (option_index)
+    {
+      /* A warning classified as an error.  */
+      if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN)
+	  && diag_kind == DK_ERROR)
+	return concat (cl_options[OPT_Werror_].opt_text,
+		       /* Skip over "-W".  */
+		       cl_options[option_index].opt_text + 2,
+		       NULL);
+      /* A warning with option.  */
+      else
+	return xstrdup (cl_options[option_index].opt_text);
+    }
+  /* A warning without option classified as an error.  */
+  else if (orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN
+	   || diag_kind == DK_WARNING)
+    {
+      if (context->warning_as_error_requested)
+	return xstrdup (cl_options[OPT_Werror].opt_text);
+      else
+	return xstrdup (_("enabled by default"));
+    }
+  else
+    return NULL;
+}
Index: fortran/cpp.c
===================================================================
--- fortran/cpp.c	(revision 159828)
+++ fortran/cpp.c	(working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -975,13 +975,13 @@ cb_cpp_error (cpp_reader *pfile ATTRIBUT
 {
   diagnostic_info diagnostic;
   diagnostic_t dlevel;
-  int save_warn_system_headers = warn_system_headers;
+  bool save_warn_system_headers = global_dc->warn_system_headers;
   bool ret;
 
   switch (level)
     {
     case CPP_DL_WARNING_SYSHDR:
-      warn_system_headers = 1;
+      global_dc->warn_system_headers = 1;
       /* Fall through.  */
     case CPP_DL_WARNING:
       dlevel = DK_WARNING;
@@ -1012,7 +1012,7 @@ cb_cpp_error (cpp_reader *pfile ATTRIBUT
     diagnostic_override_option_index (&diagnostic, OPT_Wcpp);
   ret = report_diagnostic (&diagnostic);
   if (level == CPP_DL_WARNING_SYSHDR)
-    warn_system_headers = save_warn_system_headers;
+    global_dc->warn_system_headers = save_warn_system_headers;
   return ret;
 }
 
Index: c-opts.c
===================================================================
--- c-opts.c	(revision 159828)
+++ c-opts.c	(working copy)
@@ -304,6 +304,8 @@ c_common_init_options (unsigned int argc
       diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
     }
 
+  global_dc->opt_permissive = OPT_fpermissive;
+
   parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
 				ident_hash, line_table);
   cb = cpp_get_callbacks (parse_in);
@@ -848,7 +850,7 @@ c_common_handle_option (size_t scode, co
       break;
 
     case OPT_fpermissive:
-      flag_permissive = value;
+      global_dc->permissive = flag_permissive = value;
       break;
 
     case OPT_fpreprocessed:
Index: c-common.c
===================================================================
--- c-common.c	(revision 159828)
+++ c-common.c	(working copy)
@@ -8358,7 +8358,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE
 {
   diagnostic_info diagnostic;
   diagnostic_t dlevel;
-  int save_warn_system_headers = warn_system_headers;
+  bool save_warn_system_headers = global_dc->warn_system_headers;
   bool ret;
 
   switch (level)
@@ -8366,7 +8366,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE
     case CPP_DL_WARNING_SYSHDR:
       if (flag_no_output)
 	return false;
-      warn_system_headers = 1;
+      global_dc->warn_system_headers = 1;
       /* Fall through.  */
     case CPP_DL_WARNING:
       if (flag_no_output)
@@ -8403,7 +8403,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE
                                     c_option_controlling_cpp_error (reason));
   ret = report_diagnostic (&diagnostic);
   if (level == CPP_DL_WARNING_SYSHDR)
-    warn_system_headers = save_warn_system_headers;
+    global_dc->warn_system_headers = save_warn_system_headers;
   return ret;
 }
 
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 159828)
+++ Makefile.in	(working copy)
@@ -942,7 +942,7 @@ TREE_SSA_LIVE_H = tree-ssa-live.h $(PART
 TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H)
 SSAEXPAND_H = ssaexpand.h $(TREE_SSA_LIVE_H)
 PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H)
-DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H) options.h
+DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
 C_PRETTY_PRINT_H = c-pretty-print.h $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
 SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H)
 LAMBDA_H = lambda.h $(TREE_H) vec.h $(GGC_H)
@@ -2735,12 +2735,12 @@ fold-const.o : fold-const.c $(CONFIG_H) 
    $(GIMPLE_H) realmpfr.h
 diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    version.h $(INPUT_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) \
-   diagnostic.def opts.h
+   diagnostic.def
 opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \
    output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
    $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \
-   $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H)
+   $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h
 opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h intl.h
 targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
@@ -2766,7 +2766,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM
    $(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \
    opts.h params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
    tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
-   tree-pretty-print.h
+   tree-pretty-print.h opts-diagnostic.h
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
 	  -DTARGET_NAME=\"$(target_noncanonical)\" \
 	  -c $(srcdir)/toplev.c $(OUTPUT_OPTION)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]