Eliminate report_diagnostic macro
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 5 May 2017 21:01:05 +0000 (21:01 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 5 May 2017 21:01:05 +0000 (21:01 +0000)
This patch eliminates the report_diagnostic macro, manually
expanding it in all sites in the code.

No functional change intended.

gcc/c-family/ChangeLog:
* c-common.c (c_cpp_error): Replace report_diagnostic
with diagnostic_report_diagnostic.

gcc/c/ChangeLog:
* c-decl.c (warn_defaults_to): Replace report_diagnostic
with diagnostic_report_diagnostic.
* c-errors.c (pedwarn_c99): Likewise.
(pedwarn_c90): Likewise.

gcc/cp/ChangeLog:
* error.c (pedwarn_cxx98): Replace report_diagnostic
with diagnostic_report_diagnostic.

gcc/ChangeLog:
* diagnostic.c (diagnostic_impl): Replace report_diagnostic
with diagnostic_report_diagnostic.
(diagnostic_n_impl_richloc): Likewise.
* diagnostic.h (report_diagnostic): Delete macro.
* rtl-error.c (diagnostic_for_asm): Replace report_diagnostic
with diagnostic_report_diagnostic.
* substring-locations.c (format_warning_va): Likewise.

gcc/fortran/ChangeLog:
* cpp.c (cb_cpp_error): Replace report_diagnostic
with diagnostic_report_diagnostic.
* error.c (gfc_warning): Likewise.
(gfc_warning_now_at): Likewise.
(gfc_warning_now): Likewise.
(gfc_warning_internal): Likewise.
(gfc_error_now): Likewise.
(gfc_fatal_error): Likewise.
(gfc_error_opt): Likewise.
(gfc_internal_error): Likewise.

From-SVN: r247663

15 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/c/c-errors.c
gcc/cp/ChangeLog
gcc/cp/error.c
gcc/diagnostic.c
gcc/diagnostic.h
gcc/fortran/ChangeLog
gcc/fortran/cpp.c
gcc/fortran/error.c
gcc/rtl-error.c
gcc/substring-locations.c

index 079fb47..72c8c9e 100644 (file)
@@ -1,5 +1,15 @@
 2017-05-05  David Malcolm  <dmalcolm@redhat.com>
 
+       * diagnostic.c (diagnostic_impl): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+       (diagnostic_n_impl_richloc): Likewise.
+       * diagnostic.h (report_diagnostic): Delete macro.
+       * rtl-error.c (diagnostic_for_asm): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+       * substring-locations.c (format_warning_va): Likewise.
+
+2017-05-05  David Malcolm  <dmalcolm@redhat.com>
+
        * diagnostic.c (diagnostic_report_diagnostic): Eliminate
        save/restor of format_spec.  Move option-printing code to...
        (print_option_information): ...this new function, and
index 63d4197..a1bb25c 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-05  David Malcolm  <dmalcolm@redhat.com>
+
+       * c-common.c (c_cpp_error): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+
 2017-05-04  Martin Sebor  <msebor@redhat.com>
 
        PR translation/80280
index 0884922..f46b254 100644 (file)
@@ -6109,7 +6109,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason,
                                  richloc, dlevel);
   diagnostic_override_option_index (&diagnostic,
                                     c_option_controlling_cpp_error (reason));
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   if (level == CPP_DL_WARNING_SYSHDR)
     global_dc->dc_warn_system_headers = save_warn_system_headers;
   return ret;
index 3c26eac..45f375f 100644 (file)
@@ -1,3 +1,10 @@
+2017-05-05  David Malcolm  <dmalcolm@redhat.com>
+
+       * c-decl.c (warn_defaults_to): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+       * c-errors.c (pedwarn_c99): Likewise.
+       (pedwarn_c90): Likewise.
+
 2017-05-01  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>
 
         PR c++/80038
index 64a1107..b779d37 100644 (file)
@@ -5486,7 +5486,7 @@ warn_defaults_to (location_t location, int opt, const char *gmsgid, ...)
   diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
                        flag_isoc99 ? DK_PEDWARN : DK_WARNING);
   diagnostic.option_index = opt;
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (ap);
 }
 
index 2c9267c..aa9ce42 100644 (file)
@@ -48,7 +48,7 @@ pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...)
                           (pedantic && !flag_isoc11)
                           ? DK_PEDWARN : DK_WARNING);
       diagnostic.option_index = OPT_Wc99_c11_compat;
-      warned = report_diagnostic (&diagnostic);
+      warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
     }
   /* -Wno-c99-c11-compat suppresses even the pedwarns.  */
   else if (warn_c99_c11_compat == 0)
@@ -58,7 +58,7 @@ pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...)
     {
       diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
       diagnostic.option_index = opt;
-      warned = report_diagnostic (&diagnostic);
+      warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
     }
   va_end (ap);
   return warned;
@@ -92,7 +92,7 @@ pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
                               (pedantic && !flag_isoc99)
                               ? DK_PEDWARN : DK_WARNING);
          diagnostic.option_index = opt;
-         report_diagnostic (&diagnostic);
+         diagnostic_report_diagnostic (global_dc, &diagnostic);
          warned = true;
          goto out;
        }
@@ -105,7 +105,7 @@ pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
                           (pedantic && !flag_isoc99)
                           ? DK_PEDWARN : DK_WARNING);
       diagnostic.option_index = OPT_Wc90_c99_compat;
-      report_diagnostic (&diagnostic);
+      diagnostic_report_diagnostic (global_dc, &diagnostic);
     }
   /* -Wno-c90-c99-compat suppresses the pedwarns.  */
   else if (warn_c90_c99_compat == 0)
@@ -115,7 +115,7 @@ pedwarn_c90 (location_t location, int opt, const char *gmsgid, ...)
     {
       diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
       diagnostic.option_index = opt;
-      report_diagnostic (&diagnostic);
+      diagnostic_report_diagnostic (global_dc, &diagnostic);
       warned = true;
     }
 out:
index f81b686..8389282 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-05  David Malcolm  <dmalcolm@redhat.com>
+
+       * error.c (pedwarn_cxx98): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+
 2017-05-05  Nathan Sidwell  <nathan@acm.org>
 
        * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
index a83ecb2..0912d2d 100644 (file)
@@ -3755,7 +3755,7 @@ pedwarn_cxx98 (location_t location, int opt, const char *gmsgid, ...)
   diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
                       (cxx_dialect == cxx98) ? DK_PEDWARN : DK_WARNING);
   diagnostic.option_index = opt;
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (ap);
   return ret;
 }
index f1b6b1e..815bdb0 100644 (file)
@@ -1076,7 +1076,7 @@ diagnostic_impl (rich_location *richloc, int opt,
       if (kind == DK_WARNING || kind == DK_PEDWARN)
        diagnostic.option_index = opt;
     }
-  return report_diagnostic (&diagnostic);
+  return diagnostic_report_diagnostic (global_dc, &diagnostic);
 }
 
 /* Same as diagonostic_n_impl taking rich_location instead of location_t.  */
@@ -1092,7 +1092,7 @@ diagnostic_n_impl_richloc (rich_location *richloc, int opt, int n,
                                   ap, richloc, kind);
   if (kind == DK_WARNING)
     diagnostic.option_index = opt;
-  return report_diagnostic (&diagnostic);
+  return diagnostic_report_diagnostic (global_dc, &diagnostic);
 } 
 
 /* Implement inform_n, warning_n, and error_n, as documented and
index 91a9642..846a158 100644 (file)
@@ -278,8 +278,6 @@ extern diagnostic_context *global_dc;
   (!(DC)->dc_inhibit_warnings                                          \
    && !(in_system_header_at (LOC) && !(DC)->dc_warn_system_headers))
 
-#define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
-
 /* Override the option index to be used for reporting a
    diagnostic.  */
 #define diagnostic_override_option_index(DI, OPTIDX) \
index 1cc78c9..27fcf6e 100644 (file)
@@ -1,3 +1,16 @@
+2017-05-05  David Malcolm  <dmalcolm@redhat.com>
+
+       * cpp.c (cb_cpp_error): Replace report_diagnostic
+       with diagnostic_report_diagnostic.
+       * error.c (gfc_warning): Likewise.
+       (gfc_warning_now_at): Likewise.
+       (gfc_warning_now): Likewise.
+       (gfc_warning_internal): Likewise.
+       (gfc_error_now): Likewise.
+       (gfc_fatal_error): Likewise.
+       (gfc_error_opt): Likewise.
+       (gfc_internal_error): Likewise.
+
 2017-05-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/37131
index 6ac37ad..4d1b56a 100644 (file)
@@ -1062,7 +1062,7 @@ cb_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason,
                                  richloc, dlevel);
   if (reason == CPP_W_WARNING_DIRECTIVE)
     diagnostic_override_option_index (&diagnostic, OPT_Wcpp);
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   if (level == CPP_DL_WARNING_SYSHDR)
     global_dc->dc_warn_system_headers = save_warn_system_headers;
   return ret;
index 0312499..eeb7a78 100644 (file)
@@ -789,7 +789,7 @@ gfc_warning (int opt, const char *gmsgid, va_list ap)
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
                       DK_WARNING);
   diagnostic.option_index = opt;
-  bool ret = report_diagnostic (&diagnostic);
+  bool ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
 
   if (buffered_p)
     {
@@ -1138,7 +1138,7 @@ gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...)
   va_start (argp, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_WARNING);
   diagnostic.option_index = opt;
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
   return ret;
 }
@@ -1157,7 +1157,7 @@ gfc_warning_now (int opt, const char *gmsgid, ...)
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
                       DK_WARNING);
   diagnostic.option_index = opt;
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
   return ret;
 }
@@ -1176,7 +1176,7 @@ gfc_warning_internal (int opt, const char *gmsgid, ...)
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
                       DK_WARNING);
   diagnostic.option_index = opt;
-  ret = report_diagnostic (&diagnostic);
+  ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
   return ret;
 }
@@ -1194,7 +1194,7 @@ gfc_error_now (const char *gmsgid, ...)
 
   va_start (argp, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_ERROR);
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
 }
 
@@ -1210,7 +1210,7 @@ gfc_fatal_error (const char *gmsgid, ...)
 
   va_start (argp, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_FATAL);
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
 
   gcc_unreachable ();
@@ -1295,7 +1295,7 @@ gfc_error_opt (int opt, const char *gmsgid, va_list ap)
     }
 
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &richloc, DK_ERROR);
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
 
   if (buffered_p)
     {
@@ -1345,7 +1345,7 @@ gfc_internal_error (const char *gmsgid, ...)
 
   va_start (argp, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_ICE);
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
   va_end (argp);
 
   gcc_unreachable ();
index c8a1191..e04bd7e 100644 (file)
@@ -71,7 +71,7 @@ diagnostic_for_asm (const rtx_insn *insn, const char *msg, va_list *args_ptr,
 
   diagnostic_set_info (&diagnostic, msg, args_ptr,
                       &richloc, kind);
-  report_diagnostic (&diagnostic);
+  diagnostic_report_diagnostic (global_dc, &diagnostic);
 }
 
 void
index e2d8dd7..433023d 100644 (file)
@@ -150,7 +150,7 @@ format_warning_va (const substring_loc &fmt_loc,
   diagnostic_info diagnostic;
   diagnostic_set_info (&diagnostic, gmsgid, ap, &richloc, DK_WARNING);
   diagnostic.option_index = opt;
-  bool warned = report_diagnostic (&diagnostic);
+  bool warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
 
   if (!err && fmt_substring_loc && !substring_within_range)
     /* Case 2.  */