]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagn...
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 20 Aug 2014 23:07:29 +0000 (23:07 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 20 Aug 2014 23:07:29 +0000 (23:07 +0000)
gcc/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/44054
* diagnostic.c (default_diagnostic_finalizer): Move caret printing
 to here ...
(diagnostic_report_diagnostic): ... from here.
* toplev.c (general_init): Move code to c-family.

gcc/cp/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/44054
* error.c (cp_diagnostic_finalizer): Delete.
(init_error): Do not set diagnostic_finalizer here.

gcc/c-family/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/44054
* c-opts.c: Include tree-diagnostics.h.
(c_diagnostic_finalizer): New.
(c_common_initialize_diagnostics): Use it.

gcc/fortran/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/44054
* error.c (gfc_diagnostic_finalizer): Call default finalizer.

From-SVN: r214245

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/cp/ChangeLog
gcc/cp/error.c
gcc/diagnostic.c
gcc/fortran/ChangeLog
gcc/fortran/error.c
gcc/toplev.c

index 9351048440cacbfc22659ccca62e26be134476db..03599dfff0e51b4f3241488698fe60c0e7adc434 100644 (file)
@@ -1,3 +1,11 @@
+2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR fortran/44054
+       * diagnostic.c (default_diagnostic_finalizer): Move caret printing
+        to here ...
+       (diagnostic_report_diagnostic): ... from here.
+       * toplev.c (general_init): Move code to c-family.
+
 2014-08-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * df.h (web_entry_base): Replace existing struct web_entry with a
index 8119b06e650681e61e130321c84c5863d0850808..e8673b54d28775b3494c7d70d47962f232d97b55 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR fortran/44054
+       * c-opts.c: Include tree-diagnostics.h.
+       (c_diagnostic_finalizer): New.
+       (c_common_initialize_diagnostics): Use it.
+
 2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR preprocessor/51303
index 2b423e2174b24ee4697f4b3b7cfd7f0e9c9ae246..5cae2b8e8d146e056111c3b7c1eddd9a48afac80 100644 (file)
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "toplev.h"
 #include "langhooks.h"
 #include "diagnostic.h"
+#include "tree-diagnostic.h" /* for virt_loc_aware_diagnostic_finalizer */
 #include "intl.h"
 #include "cppdefault.h"
 #include "incpath.h"
@@ -164,6 +165,19 @@ c_common_option_lang_mask (void)
   return lang_flags[c_language];
 }
 
+/* Diagnostic finalizer for C/C++/Objective-C/Objective-C++.  */
+static void
+c_diagnostic_finalizer (diagnostic_context *context,
+                       diagnostic_info *diagnostic)
+{
+  diagnostic_show_locus (context, diagnostic);
+  /* By default print macro expansion contexts in the diagnostic
+     finalizer -- for tokens resulting from macro expansion.  */
+  virt_loc_aware_diagnostic_finalizer (context, diagnostic);
+  pp_destroy_prefix (context->printer);
+  pp_newline_and_flush (context->printer);
+}
+
 /* Common diagnostics initialization.  */
 void
 c_common_initialize_diagnostics (diagnostic_context *context)
@@ -179,7 +193,7 @@ c_common_initialize_diagnostics (diagnostic_context *context)
         diagnostic message.  */
       diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
     }
-
+  diagnostic_finalizer (context) = c_diagnostic_finalizer;
   context->opt_permissive = OPT_fpermissive;
 }
 
index 6d61f75b804b9ef7d7bed07dee36dff68cfa639e..27e22497357757a24a3ac36345b476893c2bfc49 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR fortran/44054
+       * error.c (cp_diagnostic_finalizer): Delete.
+       (init_error): Do not set diagnostic_finalizer here.
+
 2014-08-19  Marek Polacek  <polacek@redhat.com>
 
        PR c++/62153
index 2ce6490681bb1be91b18e23b11483734822c8aec..9f0498dbb9900145f5f0409743cac87649006190 100644 (file)
@@ -99,7 +99,6 @@ static void print_instantiation_partial_context (diagnostic_context *,
                                                 struct tinst_level *,
                                                 location_t);
 static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
-static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
 static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
 
 static bool cp_printer (pretty_printer *, text_info *, const char *,
@@ -109,7 +108,7 @@ void
 init_error (void)
 {
   diagnostic_starter (global_dc) = cp_diagnostic_starter;
-  diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
+  /* diagnostic_finalizer is already c_diagnostic_finalizer.  */
   diagnostic_format_decoder (global_dc) = cp_printer;
 
   new (cxx_pp) cxx_pretty_printer ();
@@ -3041,14 +3040,6 @@ cp_diagnostic_starter (diagnostic_context *context,
                                                                 diagnostic));
 }
 
-static void
-cp_diagnostic_finalizer (diagnostic_context *context,
-                        diagnostic_info *diagnostic)
-{
-  virt_loc_aware_diagnostic_finalizer (context, diagnostic);
-  pp_destroy_prefix (context->printer);
-}
-
 /* Print current function onto BUFFER, in the process of reporting
    a diagnostic message.  Called from cp_diagnostic_starter.  */
 static void
index 62447212d49324ce118705159472d45d8d0241d6..9e6bfe52bffb7cee1147fe6216c0c1936b59f52e 100644 (file)
@@ -554,9 +554,12 @@ default_diagnostic_starter (diagnostic_context *context,
 }
 
 void
-default_diagnostic_finalizer (diagnostic_context *context ATTRIBUTE_UNUSED,
-                             diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
+default_diagnostic_finalizer (diagnostic_context *context,
+                             diagnostic_info *diagnostic)
 {
+  diagnostic_show_locus (context, diagnostic);
+  pp_destroy_prefix (context->printer);
+  pp_newline_and_flush (context->printer);
 }
 
 /* Interface to specify diagnostic kind overrides.  Returns the
@@ -805,10 +808,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
   pp_format (context->printer, &diagnostic->message);
   (*diagnostic_starter (context)) (context, diagnostic);
   pp_output_formatted_text (context->printer);
-  diagnostic_show_locus (context, diagnostic);
   (*diagnostic_finalizer (context)) (context, diagnostic);
-  pp_destroy_prefix (context->printer);
-  pp_newline_and_flush (context->printer);
   diagnostic_action_after_output (context, diagnostic);
   diagnostic->message.format_spec = saved_format_spec;
   diagnostic->x_data = NULL;
index 9d939ea35c3d98ea28bcaecdf02bade5c7e5f293..d47bffc2a7fc3355b2e14cd3079f08d1ea8feee2 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR fortran/44054
+       * error.c (gfc_diagnostic_finalizer): Call default finalizer.
+
 2014-08-20  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>
 
        * options.c (gfc_init_options_struct): assert that the frontend sets
index e3f44f755052b0db5b07ec31466c74840daa14f7..7aab46d4311aa728174b5144f2914546bd22ccd5 100644 (file)
@@ -1016,9 +1016,10 @@ gfc_diagnostic_starter (diagnostic_context *context,
 }
 
 static void
-gfc_diagnostic_finalizer (diagnostic_context *context ATTRIBUTE_UNUSED,
-                         diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
+gfc_diagnostic_finalizer (diagnostic_context *context,
+                         diagnostic_info *diagnostic)
 {
+  default_diagnostic_finalizer(context, diagnostic);
 }
 
 /* Give a warning about the command-line.  */
index aaad68816e48c1b35a8038dd7f0d2b66f3dd85a7..a7f4b581f42060dd426032e12d7b6774e0835dae 100644 (file)
@@ -1115,11 +1115,6 @@ general_init (const char *argv0)
   /* Set a default printer.  Language specific initializations will
      override it later.  */
   tree_diagnostics_defaults (global_dc);
-  /* FIXME: This should probably be moved to C-family
-     language-specific initializations.  */
-  /* By default print macro expansion contexts in the diagnostic
-     finalizer -- for tokens resulting from macro expansion.  */
-  diagnostic_finalizer (global_dc) = virt_loc_aware_diagnostic_finalizer;
 
   global_dc->show_caret
     = global_options_init.x_flag_diagnostics_show_caret;