From 56d3558517e7d7b75ff6704913f563a11eb13118 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 5 May 2017 21:01:05 +0000 Subject: [PATCH] Eliminate report_diagnostic macro 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 --- gcc/ChangeLog | 10 ++++++++++ gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-common.c | 2 +- gcc/c/ChangeLog | 7 +++++++ gcc/c/c-decl.c | 2 +- gcc/c/c-errors.c | 10 +++++----- gcc/cp/ChangeLog | 5 +++++ gcc/cp/error.c | 2 +- gcc/diagnostic.c | 4 ++-- gcc/diagnostic.h | 2 -- gcc/fortran/ChangeLog | 13 +++++++++++++ gcc/fortran/cpp.c | 2 +- gcc/fortran/error.c | 16 ++++++++-------- gcc/rtl-error.c | 2 +- gcc/substring-locations.c | 2 +- 15 files changed, 61 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 079fb47..72c8c9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2017-05-05 David Malcolm + * 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 + * diagnostic.c (diagnostic_report_diagnostic): Eliminate save/restor of format_spec. Move option-printing code to... (print_option_information): ...this new function, and diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 63d4197..a1bb25c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-05-05 David Malcolm + + * c-common.c (c_cpp_error): Replace report_diagnostic + with diagnostic_report_diagnostic. + 2017-05-04 Martin Sebor PR translation/80280 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 0884922..f46b254 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -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; diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 3c26eac..45f375fd 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2017-05-05 David Malcolm + + * 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 PR c++/80038 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 64a11079..b779d37 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/ChangeLog b/gcc/cp/ChangeLog index f81b686..8389282 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-05-05 David Malcolm + + * error.c (pedwarn_cxx98): Replace report_diagnostic + with diagnostic_report_diagnostic. + 2017-05-05 Nathan Sidwell * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index a83ecb2..0912d2d 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index f1b6b1e..815bdb0 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -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 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/ChangeLog b/gcc/fortran/ChangeLog index 1cc78c9..27fcf6e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2017-05-05 David Malcolm + + * 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 PR fortran/37131 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 0312499..eeb7a78 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) { @@ -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 (); 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. */ -- 2.7.4