https://gcc.gnu.org/g:24ffe3ea649d07f8fb4d14b89b61bf9e174069fd
commit r16-2550-g24ffe3ea649d07f8fb4d14b89b61bf9e174069fd Author: David Malcolm <dmalc...@redhat.com> Date: Fri Jul 25 15:13:45 2025 -0400 diagnostics: eliminate ::diagnostic_info typedef No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * c-opts.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/cp/ChangeLog: * constexpr.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * cp-tree.h: Likewise. * error.cc: Likewise. * module.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Likewise. gcc/ChangeLog: * diagnostic.h: Eliminate "diagnostic_info" typedef. * diagnostics/context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * langhooks.cc: Likewise. * libgdiagnostics.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. * tree-diagnostic.cc: Likewise. * tree-diagnostic.h: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * error.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * resolve/rust-ice-finalizer.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * resolve/rust-ice-finalizer.h: Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show_template_tree_color_plugin.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. libcc1/ChangeLog: * context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". Signed-off-by: David Malcolm <dmalc...@redhat.com> Diff: --- gcc/c-family/c-common.cc | 2 +- gcc/c-family/c-opts.cc | 2 +- gcc/c/c-errors.cc | 8 +++--- gcc/cp/constexpr.cc | 2 +- gcc/cp/cp-tree.h | 2 +- gcc/cp/error.cc | 14 +++++----- gcc/cp/module.cc | 3 ++- gcc/d/d-diagnostic.cc | 2 +- gcc/diagnostic.h | 30 ++++++++++++---------- gcc/diagnostics/context.cc | 10 +++++--- gcc/fortran/cpp.cc | 2 +- gcc/fortran/error.cc | 26 +++++++++---------- gcc/jit/dummy-frontend.cc | 6 ++--- gcc/langhooks.cc | 2 +- gcc/libgdiagnostics.cc | 6 ++--- gcc/m2/gm2-gcc/m2linemap.cc | 6 ++--- gcc/m2/gm2-gcc/rtegraph.cc | 2 +- gcc/rtl-error.cc | 2 +- gcc/rust/resolve/rust-ice-finalizer.cc | 2 +- gcc/rust/resolve/rust-ice-finalizer.h | 2 +- gcc/substring-locations.cc | 2 +- .../plugin/show_template_tree_color_plugin.cc | 3 ++- .../gcc.dg/plugin/diagnostic_group_plugin.cc | 2 +- .../plugin/diagnostic_plugin_test_show_locus.cc | 4 +-- .../gcc.dg/plugin/location_overflow_plugin.cc | 4 +-- gcc/toplev.cc | 3 ++- gcc/tree-diagnostic.cc | 14 +++++----- gcc/tree-diagnostic.h | 2 +- libcc1/context.cc | 2 +- 29 files changed, 88 insertions(+), 79 deletions(-) diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 17c2aed6939e..07059dc1f920 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -7068,7 +7068,7 @@ c_cpp_diagnostic (cpp_reader *pfile ATTRIBUTE_UNUSED, rich_location *richloc, const char *msg, va_list *ap) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; enum diagnostics::kind dlevel; bool save_warn_system_headers = global_dc->m_warn_system_headers; bool ret; diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index d256ea604445..2ce05e5c7ce6 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -170,7 +170,7 @@ c_common_option_lang_mask (void) /* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */ static void c_diagnostic_text_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diagnostic, enum diagnostics::kind) { pretty_printer *const pp = text_output.get_printer (); diff --git a/gcc/c/c-errors.cc b/gcc/c/c-errors.cc index 39ec1304766d..e2c74fe81891 100644 --- a/gcc/c/c-errors.cc +++ b/gcc/c/c-errors.cc @@ -36,7 +36,7 @@ pedwarn_c23 (location_t location, diagnostics::option_id option_id, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; bool warned = false; rich_location richloc (line_table, location); @@ -82,7 +82,7 @@ pedwarn_c11 (location_t location, diagnostics::option_id option_id, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; bool warned = false; rich_location richloc (line_table, location); @@ -129,7 +129,7 @@ pedwarn_c99 (location_t location, diagnostics::option_id option_id, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; bool warned = false; rich_location richloc (line_table, location); @@ -173,7 +173,7 @@ pedwarn_c90 (location_t location, diagnostics::option_id option_id, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; bool warned = false; rich_location richloc (line_table, location); diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 202d64b21431..f92beb17906e 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -153,7 +153,7 @@ static bool constexpr_error (location_t location, bool constexpr_fundef_p, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; rich_location richloc (line_table, location); va_start (ap, gmsgid); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e3bfed0ef567..c8391d60cdac 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -8465,7 +8465,7 @@ extern void cxx_print_type (FILE *, tree, int); extern void cxx_print_identifier (FILE *, tree, int); extern void cxx_print_error_function (diagnostics::text_sink &, const char *, - const diagnostic_info *); + const diagnostics::diagnostic_info *); /* in typeck.cc */ /* Says how we should behave when comparing two arrays one of which diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 814aa07bc4b0..c427163d2834 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -104,9 +104,9 @@ static void print_instantiation_partial_context (diagnostics::text_sink &, location_t); static void maybe_print_constraint_context (diagnostics::text_sink &); static void cp_diagnostic_text_starter (diagnostics::text_sink &, - const diagnostic_info *); + const diagnostics::diagnostic_info *); static void cp_print_error_function (diagnostics::text_sink &, - const diagnostic_info *); + const diagnostics::diagnostic_info *); static bool cp_printer (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &); @@ -251,7 +251,7 @@ erroneous_templates_t *erroneous_templates; static void cp_adjust_diagnostic_info (diagnostics::context *context, - diagnostic_info *diagnostic) + diagnostics::diagnostic_info *diagnostic) { if (diagnostic->m_kind == diagnostics::kind::error) if (tree tmpl = get_current_template ()) @@ -3763,7 +3763,7 @@ eh_spec_to_string (tree p, int /*v*/) void cxx_print_error_function (diagnostics::text_sink &text_output, const char *file, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { char *prefix; if (file) @@ -3778,7 +3778,7 @@ cxx_print_error_function (diagnostics::text_sink &text_output, static void cp_diagnostic_text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { pp_set_prefix (text_output.get_printer (), text_output.build_indent_prefix (true)); @@ -3795,7 +3795,7 @@ cp_diagnostic_text_starter (diagnostics::text_sink &text_output, a diagnostic message. Called from cp_diagnostic_starter. */ static void cp_print_error_function (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { /* If we are in an instantiation context, current_function_decl is likely to be wrong, so just rely on print_instantiation_full_context. */ @@ -4932,7 +4932,7 @@ pedwarn_cxx98 (location_t location, diagnostics::option_id option_id, const char *gmsgid, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; bool ret; rich_location richloc (line_table, location); diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 42a1979ac510..0a689bb32233 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4822,7 +4822,8 @@ noisy_p () return false; pp_needs_newline (global_dc->get_reference_printer ()) = true; - diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL); + diagnostic_set_last_function (global_dc, + (diagnostics::diagnostic_info *) nullptr); return true; } diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc index 44749344ce48..e666ddf48b79 100644 --- a/gcc/d/d-diagnostic.cc +++ b/gcc/d/d-diagnostic.cc @@ -193,7 +193,7 @@ d_diagnostic_report_diagnostic (const SourceLoc &loc, int opt, if (loc.filename.length != 0 || !verbatim) { rich_location rich_loc (line_table, make_location_t (loc)); - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; char *xformat = expand_d_format (format); diagnostic_set_info_translated (&diagnostic, xformat, &argp, diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 5d9751469e0b..d22d77b19882 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -26,8 +26,6 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "diagnostics/diagnostic-info.h" -typedef diagnostics::diagnostic_info diagnostic_info; - #include "diagnostics/context.h" /* Extension hooks for client. */ @@ -58,7 +56,7 @@ extern diagnostics::context *global_dc; diagnostic. */ inline void -diagnostic_set_option_id (diagnostic_info *info, +diagnostic_set_option_id (diagnostics::diagnostic_info *info, diagnostics::option_id opt_id) { info->m_option_id = opt_id; @@ -174,7 +172,7 @@ diagnostic_pop_diagnostics (diagnostics::context *context, inline bool diagnostic_report_diagnostic (diagnostics::context *context, - diagnostic_info *diagnostic) + diagnostics::diagnostic_info *diagnostic) { context->begin_group (); bool warned = context->report_diagnostic (diagnostic); @@ -183,10 +181,14 @@ diagnostic_report_diagnostic (diagnostics::context *context, } #ifdef ATTRIBUTE_GCC_DIAG -extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *, - rich_location *, enum diagnostics::kind) ATTRIBUTE_GCC_DIAG(2,0); -extern void diagnostic_set_info_translated (diagnostic_info *, const char *, - va_list *, rich_location *, +extern void diagnostic_set_info (diagnostics::diagnostic_info *, + const char *, va_list *, + rich_location *, + enum diagnostics::kind) + ATTRIBUTE_GCC_DIAG(2,0); +extern void diagnostic_set_info_translated (diagnostics::diagnostic_info *, + const char *, va_list *, + rich_location *, enum diagnostics::kind) ATTRIBUTE_GCC_DIAG(2,0); #endif @@ -194,13 +196,13 @@ extern void diagnostic_set_info_translated (diagnostic_info *, const char *, namespace diagnostics { void default_text_starter (diagnostics::text_sink &, - const diagnostic_info *); + const diagnostics::diagnostic_info *); template <typename Sink> void default_start_span_fn (const diagnostics::location_print_policy &, Sink &sink, expanded_location); void default_text_finalizer (diagnostics::text_sink &, - const diagnostic_info *, + const diagnostics::diagnostic_info *, enum diagnostics::kind); } // namespace diagnostics @@ -212,7 +214,8 @@ int get_terminal_width (void); specifies which location. By default, expand the first one. */ inline location_t -diagnostic_location (const diagnostic_info * diagnostic, int which = 0) +diagnostic_location (const diagnostics::diagnostic_info *diagnostic, + int which = 0) { return diagnostic->m_message.get_location (which); } @@ -220,7 +223,7 @@ diagnostic_location (const diagnostic_info * diagnostic, int which = 0) /* Return the number of locations to be printed in DIAGNOSTIC. */ inline unsigned int -diagnostic_num_locations (const diagnostic_info * diagnostic) +diagnostic_num_locations (const diagnostics::diagnostic_info *diagnostic) { return diagnostic->m_message.m_richloc->get_num_locations (); } @@ -230,7 +233,8 @@ diagnostic_num_locations (const diagnostic_info * diagnostic) expand the first one. */ inline expanded_location -diagnostic_expand_location (const diagnostic_info * diagnostic, int which = 0) +diagnostic_expand_location (const diagnostics::diagnostic_info *diagnostic, + int which = 0) { return diagnostic->m_richloc->get_expanded_location (which); } diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc index 64bb315bd1fa..842baedc89e9 100644 --- a/gcc/diagnostics/context.cc +++ b/gcc/diagnostics/context.cc @@ -580,8 +580,9 @@ context::initialize_fixits_change_set () /* Initialize DIAGNOSTIC, where the message MSG has already been translated. */ void -diagnostic_set_info_translated (diagnostic_info *diagnostic, const char *msg, - va_list *args, rich_location *richloc, +diagnostic_set_info_translated (diagnostics::diagnostic_info *diagnostic, + const char *msg, va_list *args, + rich_location *richloc, enum diagnostics::kind kind) { gcc_assert (richloc); @@ -598,8 +599,9 @@ diagnostic_set_info_translated (diagnostic_info *diagnostic, const char *msg, /* Initialize DIAGNOSTIC, where the message GMSGID has not yet been translated. */ void -diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid, - va_list *args, rich_location *richloc, +diagnostic_set_info (diagnostics::diagnostic_info *diagnostic, + const char *gmsgid, va_list *args, + rich_location *richloc, enum diagnostics::kind kind) { gcc_assert (richloc); diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc index 01113589fe7b..15ecc7dd5fa3 100644 --- a/gcc/fortran/cpp.cc +++ b/gcc/fortran/cpp.cc @@ -1088,7 +1088,7 @@ cb_cpp_diagnostic (cpp_reader *pfile ATTRIBUTE_UNUSED, rich_location *richloc, const char *msg, va_list *ap) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; enum diagnostics::kind dlevel; bool save_warn_system_headers = global_dc->m_warn_system_headers; bool ret; diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc index 8d913aa89ef6..564513da64c5 100644 --- a/gcc/fortran/error.cc +++ b/gcc/fortran/error.cc @@ -237,13 +237,13 @@ gfc_clear_diagnostic_buffer (diagnostics::buffer *this_buffer) /* The currently-printing diagnostic, for use by gfc_format_decoder, for colorizing %C and %L. */ -static diagnostic_info *curr_diagnostic; +static diagnostics::diagnostic_info *curr_diagnostic; /* A helper function to call diagnostic_report_diagnostic, while setting curr_diagnostic for the duration of the call. */ static bool -gfc_report_diagnostic (diagnostic_info *diagnostic) +gfc_report_diagnostic (diagnostics::diagnostic_info *diagnostic) { gcc_assert (diagnostic != NULL); curr_diagnostic = diagnostic; @@ -261,7 +261,7 @@ gfc_warning (int opt, const char *gmsgid, va_list ap) va_list argp; va_copy (argp, ap); - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); diagnostics::buffer *old_buffer = global_dc->get_diagnostic_buffer (); gcc_assert (!old_buffer); @@ -461,7 +461,7 @@ gfc_format_decoder (pretty_printer *pp, text_info *text, const char *spec, caller is responsible for freeing the memory. */ static char * gfc_diagnostic_build_kind_prefix (diagnostics::context *context, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { static const char *const diagnostic_kind_text[] = { #define DEFINE_DIAGNOSTIC_KIND(K, T, C) (T), @@ -550,7 +550,7 @@ gfc_diagnostic_build_locus_prefix (const diagnostics::location_print_policy &loc */ static void gfc_diagnostic_text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { diagnostics::context *const context = &text_output.get_context (); pretty_printer *const pp = text_output.get_printer (); @@ -636,7 +636,7 @@ gfc_diagnostic_start_span (const diagnostics::location_print_policy &loc_policy, static void gfc_diagnostic_text_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic ATTRIBUTE_UNUSED, + const diagnostics::diagnostic_info *, enum diagnostics::kind orig_diag_kind ATTRIBUTE_UNUSED) { pretty_printer *const pp = text_output.get_printer (); @@ -651,7 +651,7 @@ bool gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...) { va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, loc); bool ret; @@ -670,7 +670,7 @@ bool gfc_warning_now (int opt, const char *gmsgid, ...) { va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); bool ret; @@ -689,7 +689,7 @@ bool gfc_warning_internal (int opt, const char *gmsgid, ...) { va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); bool ret; @@ -708,7 +708,7 @@ void gfc_error_now (const char *gmsgid, ...) { va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); error_buffer->flag = true; @@ -727,7 +727,7 @@ void gfc_fatal_error (const char *gmsgid, ...) { va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); va_start (argp, gmsgid); @@ -780,7 +780,7 @@ gfc_error_opt (int opt, const char *gmsgid, va_list ap) return; } - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location richloc (line_table, UNKNOWN_LOCATION); diagnostics::buffer *old_buffer = global_dc->get_diagnostic_buffer (); gcc_assert (!old_buffer); @@ -828,7 +828,7 @@ gfc_internal_error (const char *gmsgid, ...) { int e, w; va_list argp; - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location rich_loc (line_table, UNKNOWN_LOCATION); gfc_get_errors (&w, &e); diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index 5b56b7304523..3ffca92903f0 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -1015,7 +1015,7 @@ public: (void *)&m_playback_ctxt); } - void on_report_diagnostic (const diagnostic_info &info, + void on_report_diagnostic (const diagnostics::diagnostic_info &info, enum diagnostics::kind orig_diag_kind) final override { JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ()); @@ -1042,7 +1042,7 @@ private: static void jit_begin_diagnostic (diagnostics::text_sink &, - const diagnostic_info */*diagnostic*/) + const diagnostics::diagnostic_info */*diagnostic*/) { gcc_assert (gcc::jit::active_playback_ctxt); JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ()); @@ -1055,7 +1055,7 @@ jit_begin_diagnostic (diagnostics::text_sink &, static void jit_end_diagnostic (diagnostics::text_sink &, - const diagnostic_info *, + const diagnostics::diagnostic_info *, enum diagnostics::kind) { gcc_assert (gcc::jit::active_playback_ctxt); diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc index 56c2c733c0c1..20d27a6d7fd0 100644 --- a/gcc/langhooks.cc +++ b/gcc/langhooks.cc @@ -371,7 +371,7 @@ lhd_handle_option (size_t code ATTRIBUTE_UNUSED, void lhd_print_error_function (diagnostics::text_sink &text_output, const char *file, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { diagnostics::context *const context = &text_output.get_context (); if (diagnostic_last_function_changed (context, diagnostic)) diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc index bc7ca8a195bd..04fcc689ace1 100644 --- a/gcc/libgdiagnostics.cc +++ b/gcc/libgdiagnostics.cc @@ -243,7 +243,7 @@ public: static void text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic); + const diagnostics::diagnostic_info *diagnostic); private: diagnostics::text_sink *m_inner_sink; // borrowed from dc @@ -1446,7 +1446,7 @@ diagnostic_text_sink::set_colorize (enum diagnostic_colorize colorize) void diagnostic_text_sink::text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *info) + const diagnostics::diagnostic_info *info) { gcc_assert (info->m_x_data); const diagnostic &diag = *static_cast<const diagnostic *> (info->m_x_data); @@ -1614,7 +1614,7 @@ diagnostic_manager::emit_va (diagnostic &diag, const char *msgid, va_list *args) { m_dc.begin_group (); - diagnostic_info info; + diagnostics::diagnostic_info info; GCC_DIAGNOSTIC_PUSH_IGNORED(-Wsuggest-attribute=format) diagnostic_set_info (&info, msgid, args, diag.get_rich_location (), diagnostics_kind_from_diagnostic_level diff --git a/gcc/m2/gm2-gcc/m2linemap.cc b/gcc/m2/gm2-gcc/m2linemap.cc index 0f0bd6541f1d..89a10807a6f2 100644 --- a/gcc/m2/gm2-gcc/m2linemap.cc +++ b/gcc/m2/gm2-gcc/m2linemap.cc @@ -188,7 +188,7 @@ m2linemap_ErrorAt (location_t location, char *message) static void m2linemap_ErrorAtf_1 (location_t location, const char *message, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; rich_location richloc (line_table, location); @@ -210,7 +210,7 @@ m2linemap_ErrorAtf (location_t location, const char *message) static void m2linemap_WarningAtf_1 (location_t location, const char *message, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; rich_location richloc (line_table, location); @@ -232,7 +232,7 @@ m2linemap_WarningAtf (location_t location, const char *message) static void m2linemap_NoteAtf_1 (location_t location, const char *message, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; rich_location richloc (line_table, location); diff --git a/gcc/m2/gm2-gcc/rtegraph.cc b/gcc/m2/gm2-gcc/rtegraph.cc index 00df71d57f6d..f7b306534385 100644 --- a/gcc/m2/gm2-gcc/rtegraph.cc +++ b/gcc/m2/gm2-gcc/rtegraph.cc @@ -286,7 +286,7 @@ static void rte_error_at (location_t location, diagnostics::kind kind, const char *message, ...) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; va_list ap; rich_location richloc (line_table, location); diff --git a/gcc/rtl-error.cc b/gcc/rtl-error.cc index 04a449ccf318..7391a2f5fdac 100644 --- a/gcc/rtl-error.cc +++ b/gcc/rtl-error.cc @@ -66,7 +66,7 @@ static void diagnostic_for_asm (const rtx_insn *insn, const char *msg, va_list *args_ptr, enum diagnostics::kind kind) { - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; rich_location richloc (line_table, location_for_asm (insn)); diagnostic_set_info (&diagnostic, msg, args_ptr, diff --git a/gcc/rust/resolve/rust-ice-finalizer.cc b/gcc/rust/resolve/rust-ice-finalizer.cc index 2a0cd3bbd3ca..79a06c3b862b 100644 --- a/gcc/rust/resolve/rust-ice-finalizer.cc +++ b/gcc/rust/resolve/rust-ice-finalizer.cc @@ -23,7 +23,7 @@ namespace Resolver { void ATTRIBUTE_NORETURN funny_ice_text_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diagnostic, enum diagnostics::kind diag_kind) { gcc_assert (diag_kind == diagnostics::kind::ice_nobt); diff --git a/gcc/rust/resolve/rust-ice-finalizer.h b/gcc/rust/resolve/rust-ice-finalizer.h index f36e5582e5c1..512017639e65 100644 --- a/gcc/rust/resolve/rust-ice-finalizer.h +++ b/gcc/rust/resolve/rust-ice-finalizer.h @@ -56,7 +56,7 @@ namespace Resolver { void ATTRIBUTE_NORETURN funny_ice_text_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diagnostic, enum diagnostics::kind diag_kind); } // namespace Resolver diff --git a/gcc/substring-locations.cc b/gcc/substring-locations.cc index 9bbc76bec8c1..2f920ca46926 100644 --- a/gcc/substring-locations.cc +++ b/gcc/substring-locations.cc @@ -203,7 +203,7 @@ format_string_diagnostic_t::emit_warning_n_va (diagnostics::option_id option_id, if (!err && m_corrected_substring && substring_within_range) richloc.add_fixit_replace (fmt_substring_range, m_corrected_substring); - diagnostic_info diagnostic; + diagnostics::diagnostic_info diagnostic; if (singular_gmsgid != plural_gmsgid) { unsigned long gtn; diff --git a/gcc/testsuite/g++.dg/plugin/show_template_tree_color_plugin.cc b/gcc/testsuite/g++.dg/plugin/show_template_tree_color_plugin.cc index 289af332acfe..5d185ff769d2 100644 --- a/gcc/testsuite/g++.dg/plugin/show_template_tree_color_plugin.cc +++ b/gcc/testsuite/g++.dg/plugin/show_template_tree_color_plugin.cc @@ -21,7 +21,8 @@ int plugin_is_GPL_compatible; void -noop_text_starter_fn (diagnostics::text_sink &, const diagnostic_info *) +noop_text_starter_fn (diagnostics::text_sink &, + const diagnostics::diagnostic_info *) { } diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc index 8d44c03986cc..48f832579add 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.cc @@ -166,7 +166,7 @@ pass_test_groups::execute (function *fun) void test_diagnostic_text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { pp_set_prefix (text_output.get_printer (), xstrdup ("PREFIX: ")); } diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc index c867d463a64e..e1fc56cde643 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc @@ -132,7 +132,7 @@ static bool force_show_locus_color = false; static void custom_diagnostic_text_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diag, enum diagnostics::kind) { pretty_printer *const pp = text_output.get_printer (); @@ -144,7 +144,7 @@ custom_diagnostic_text_finalizer (diagnostics::text_sink &text_output, pp_newline (pp); diagnostic_show_locus (&text_output.get_context (), text_output.get_source_printing_options (), - diagnostic->m_richloc, diagnostic->m_kind, pp); + diag->m_richloc, diag->m_kind, pp); pp_show_color (pp) = old_show_color; pp_set_prefix (pp, saved_prefix); pp_flush (pp); diff --git a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc index bd8019a701f4..00ad8704477a 100644 --- a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc +++ b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.cc @@ -43,7 +43,7 @@ static diagnostics::text_finalizer_fn original_text_finalizer = NULL; static void verify_unpacked_ranges (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diagnostic, enum diagnostics::kind orig_diag_kind) { /* Verify that the locations are ad-hoc, not packed. */ @@ -57,7 +57,7 @@ verify_unpacked_ranges (diagnostics::text_sink &text_output, static void verify_no_columns (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic, + const diagnostics::diagnostic_info *diagnostic, enum diagnostics::kind orig_diag_kind) { /* Verify that the locations have no columns. */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 8d02f62412bb..75f807bd6a00 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -231,7 +231,8 @@ announce_function (tree decl) identifier_to_locale (lang_hooks.decl_printable_name (decl, 2))); fflush (stderr); pp_needs_newline (global_dc->get_reference_printer ()) = true; - diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL); + diagnostic_set_last_function (global_dc, + (diagnostics::diagnostic_info *) nullptr); } } diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc index 4e43842732d4..3761fc099e60 100644 --- a/gcc/tree-diagnostic.cc +++ b/gcc/tree-diagnostic.cc @@ -36,20 +36,20 @@ along with GCC; see the file COPYING3. If not see that caused an error. */ void diagnostic_report_current_function (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diag) { - location_t loc = diagnostic_location (diagnostic); + location_t loc = diagnostic_location (diag); text_output.report_current_module (loc); - lang_hooks.print_error_function (text_output, LOCATION_FILE (loc), diagnostic); + lang_hooks.print_error_function (text_output, LOCATION_FILE (loc), diag); } static void default_tree_diagnostic_text_starter (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diag) { pretty_printer *const pp = text_output.get_printer (); - diagnostic_report_current_function (text_output, diagnostic); - pp_set_prefix (pp, text_output.build_prefix (*diagnostic)); + diagnostic_report_current_function (text_output, diag); + pp_set_prefix (pp, text_output.build_prefix (*diag)); } /* Default tree printer. Handles declarations only. */ @@ -111,7 +111,7 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec, static void set_inlining_locations (diagnostics::context *, - diagnostic_info *diagnostic) + diagnostics::diagnostic_info *diagnostic) { location_t loc = diagnostic_location (diagnostic); tree block = LOCATION_BLOCK (loc); diff --git a/gcc/tree-diagnostic.h b/gcc/tree-diagnostic.h index ffb0c2bab4f4..9315d35c6bd3 100644 --- a/gcc/tree-diagnostic.h +++ b/gcc/tree-diagnostic.h @@ -49,7 +49,7 @@ along with GCC; see the file COPYING3. If not see : current_function_decl) void diagnostic_report_current_function (diagnostics::context *, - const diagnostic_info *); + const diagnostics::diagnostic_info *); void tree_diagnostics_defaults (diagnostics::context *); bool default_tree_printer (pretty_printer *, text_info *, const char *, diff --git a/libcc1/context.cc b/libcc1/context.cc index 6cfe254f9b05..38343a7c29eb 100644 --- a/libcc1/context.cc +++ b/libcc1/context.cc @@ -65,7 +65,7 @@ cc1_plugin::plugin_context *cc1_plugin::current_context; static void plugin_print_error_function (diagnostics::text_sink &text_output, const char *file, - const diagnostic_info *diagnostic) + const diagnostics::diagnostic_info *diagnostic) { if (current_function_decl != NULL_TREE && DECL_NAME (current_function_decl) != NULL_TREE