From 6c26366b071875bb22d861a7ee682c3e325d252f Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 23 Mar 2017 13:30:22 -0400
Subject: [PATCH 36/46] FIXME: get rid of report_diagnostic macro

---
 gcc/c-family/c-common.c   |  2 +-
 gcc/c/c-decl.c            |  2 +-
 gcc/c/c-errors.c          | 10 +++++-----
 gcc/cp/error.c            |  2 +-
 gcc/diagnostic.c          |  4 ++--
 gcc/diagnostic.h          |  2 --
 gcc/fortran/cpp.c         |  2 +-
 gcc/fortran/error.c       | 16 ++++++++--------
 gcc/rtl-error.c           |  2 +-
 gcc/substring-locations.c |  2 +-
 10 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 79f9b9d..fd183c9 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -6234,7 +6234,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;
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index a0dc5bc..8d5fc36 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -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);
 }
 
diff --git a/gcc/c/c-errors.c b/gcc/c/c-errors.c
index 2c9267c..aa9ce42 100644
--- a/gcc/c/c-errors.c
+++ b/gcc/c/c-errors.c
@@ -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:
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index d8c5d5e..03bf99d 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -3746,7 +3746,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;
 }
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index c4c947c..d2a465b 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -1100,7 +1100,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.  */
@@ -1116,7 +1116,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
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 91a9642..846a158 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -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) \
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 6ac37ad..4d1b56a 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -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;
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index ccf0be0..1e1fe18 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -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)
     {
@@ -1136,7 +1136,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;
 }
@@ -1155,7 +1155,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;
 }
@@ -1174,7 +1174,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;
 }
@@ -1192,7 +1192,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);
 }
 
@@ -1208,7 +1208,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 ();
@@ -1293,7 +1293,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)
     {
@@ -1343,7 +1343,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 ();
diff --git a/gcc/rtl-error.c b/gcc/rtl-error.c
index c8a1191..e04bd7e 100644
--- a/gcc/rtl-error.c
+++ b/gcc/rtl-error.c
@@ -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
diff --git a/gcc/substring-locations.c b/gcc/substring-locations.c
index e2d8dd7..433023d 100644
--- a/gcc/substring-locations.c
+++ b/gcc/substring-locations.c
@@ -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.  */
-- 
1.8.5.3

