No functional change intended. gcc/c-family/ChangeLog: * c-opts.cc (c_diagnostic_text_finalizer): Add "m_" prefix to fields of diagnostic_info.
gcc/c/ChangeLog: * c-errors.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/cp/ChangeLog: * constexpr.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. * error.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc (d_diagnostic_report_diagnostic): Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/ChangeLog: * diagnostic.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. * diagnostic.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * libgdiagnostics.cc: Likewise. * substring-locations.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. --- gcc/c-family/c-opts.cc | 2 +- gcc/c/c-errors.cc | 20 ++-- gcc/cp/constexpr.cc | 2 +- gcc/cp/error.cc | 10 +- gcc/d/d-diagnostic.cc | 2 +- gcc/diagnostic.cc | 112 +++++++++--------- gcc/diagnostic.h | 31 +++-- gcc/diagnostics/html-sink.cc | 30 ++--- gcc/diagnostics/sarif-sink.cc | 28 ++--- gcc/diagnostics/text-sink.cc | 36 +++--- gcc/fortran/error.cc | 22 ++-- gcc/libgdiagnostics.cc | 8 +- gcc/substring-locations.cc | 2 +- .../diagnostic_plugin_test_show_locus.cc | 2 +- gcc/tree-diagnostic.cc | 2 +- 15 files changed, 157 insertions(+), 152 deletions(-) diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index 96130d71afdb..88353062db47 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -179,7 +179,7 @@ c_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->richloc, diagnostic->kind, pp); + diagnostic->m_richloc, diagnostic->m_kind, pp); /* By default print macro expansion contexts in the diagnostic finalizer -- for tokens resulting from macro expansion. */ diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic); diff --git a/gcc/c/c-errors.cc b/gcc/c/c-errors.cc index 4682dca56c2c..be3ad3d5cf1e 100644 --- a/gcc/c/c-errors.cc +++ b/gcc/c/c-errors.cc @@ -49,7 +49,7 @@ pedwarn_c23 (location_t location, diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, (pedantic && !flag_isoc2y) ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = OPT_Wc23_c2y_compat; + diagnostic.m_option_id = OPT_Wc23_c2y_compat; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } /* -Wno-c23-c2y-compat suppresses even the pedwarns. */ @@ -59,7 +59,7 @@ pedwarn_c23 (location_t location, else if (pedantic && !flag_isoc2y) { diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } va_end (ap); @@ -95,9 +95,9 @@ pedwarn_c11 (location_t location, (pedantic && !flag_isoc23) ? DK_PEDWARN : DK_WARNING); if (option_id == OPT_Wpedantic) - diagnostic.option_id = OPT_Wc11_c23_compat; + diagnostic.m_option_id = OPT_Wc11_c23_compat; else - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } /* -Wno-c11-c23-compat suppresses even the pedwarns. */ @@ -107,7 +107,7 @@ pedwarn_c11 (location_t location, else if (pedantic && !flag_isoc23) { diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } va_end (ap); @@ -138,7 +138,7 @@ pedwarn_c99 (location_t location, diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, (pedantic && !flag_isoc11) ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = OPT_Wc99_c11_compat; + diagnostic.m_option_id = OPT_Wc99_c11_compat; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } /* -Wno-c99-c11-compat suppresses even the pedwarns. */ @@ -148,7 +148,7 @@ pedwarn_c99 (location_t location, else if (pedantic && !flag_isoc11) { diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; warned = diagnostic_report_diagnostic (global_dc, &diagnostic); } va_end (ap); @@ -184,7 +184,7 @@ pedwarn_c90 (location_t location, diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, (pedantic && !flag_isoc99) ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; diagnostic_report_diagnostic (global_dc, &diagnostic); warned = true; goto out; @@ -197,7 +197,7 @@ pedwarn_c90 (location_t location, diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, (pedantic && !flag_isoc99) ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = OPT_Wc90_c99_compat; + diagnostic.m_option_id = OPT_Wc90_c99_compat; diagnostic_report_diagnostic (global_dc, &diagnostic); } /* -Wno-c90-c99-compat suppresses the pedwarns. */ @@ -207,7 +207,7 @@ pedwarn_c90 (location_t location, else if (pedantic && !flag_isoc99) { diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; diagnostic_report_diagnostic (global_dc, &diagnostic); warned = true; } diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 3d52297656f3..b83d3701926b 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -168,7 +168,7 @@ constexpr_error (location_t location, bool constexpr_fundef_p, { diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, cxx_dialect < cxx23 ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = OPT_Winvalid_constexpr; + diagnostic.m_option_id = OPT_Winvalid_constexpr; ret = diagnostic_report_diagnostic (global_dc, &diagnostic); } else diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index a93a77026faa..555d8894f07e 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -253,13 +253,13 @@ static void cp_adjust_diagnostic_info (diagnostic_context *context, diagnostic_info *diagnostic) { - if (diagnostic->kind == DK_ERROR) + if (diagnostic->m_kind == DK_ERROR) if (tree tmpl = get_current_template ()) { - diagnostic->option_id = OPT_Wtemplate_body; + diagnostic->m_option_id = OPT_Wtemplate_body; if (context->m_permissive) - diagnostic->kind = DK_WARNING; + diagnostic->m_kind = DK_WARNING; bool existed; location_t &error_loc @@ -269,7 +269,7 @@ cp_adjust_diagnostic_info (diagnostic_context *context, /* Remember that this template had a parse-time error so that we'll ensure a hard error has been issued upon its instantiation. */ - error_loc = diagnostic->richloc->get_loc (); + error_loc = diagnostic->m_richloc->get_loc (); } } @@ -4940,7 +4940,7 @@ pedwarn_cxx98 (location_t location, va_start (ap, gmsgid); diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, (cxx_dialect == cxx98) ? DK_PEDWARN : DK_WARNING); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; ret = diagnostic_report_diagnostic (global_dc, &diagnostic); va_end (ap); return ret; diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc index 55cb42ed7ae4..f7e380b1119a 100644 --- a/gcc/d/d-diagnostic.cc +++ b/gcc/d/d-diagnostic.cc @@ -199,7 +199,7 @@ d_diagnostic_report_diagnostic (const SourceLoc &loc, int opt, diagnostic_set_info_translated (&diagnostic, xformat, &argp, &rich_loc, kind); if (opt != 0) - diagnostic.option_id = opt; + diagnostic.m_option_id = opt; diagnostic_report_diagnostic (global_dc, &diagnostic); } diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index b5ef93e70bc4..8ebed0bf51a9 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -672,14 +672,14 @@ diagnostic_set_info_translated (diagnostic_info *diagnostic, const char *msg, diagnostic_t kind) { gcc_assert (richloc); - diagnostic->message.m_err_no = errno; - diagnostic->message.m_args_ptr = args; - diagnostic->message.m_format_spec = msg; - diagnostic->message.m_richloc = richloc; - diagnostic->richloc = richloc; - diagnostic->metadata = nullptr; - diagnostic->kind = kind; - diagnostic->option_id = 0; + diagnostic->m_message.m_err_no = errno; + diagnostic->m_message.m_args_ptr = args; + diagnostic->m_message.m_format_spec = msg; + diagnostic->m_message.m_richloc = richloc; + diagnostic->m_richloc = richloc; + diagnostic->m_metadata = nullptr; + diagnostic->m_kind = kind; + diagnostic->m_option_id = 0; } /* Initialize DIAGNOSTIC, where the message GMSGID has not yet been @@ -1279,11 +1279,11 @@ update_effective_level_from_pragmas (diagnostic_info *diagnostic) const diagnostic_option_id option = p->option; /* The option 0 is for all the diagnostics. */ - if (option == 0 || option == diagnostic->option_id) + if (option == 0 || option == diagnostic->m_option_id) { diagnostic_t kind = p->kind; if (kind != DK_UNSPECIFIED) - diagnostic->kind = kind; + diagnostic->m_kind = kind; return kind; } } @@ -1311,13 +1311,13 @@ diagnostic_context::diagnostic_enabled (diagnostic_info *diagnostic) get_any_inlining_info (diagnostic); /* Diagnostics with no option or -fpermissive are always enabled. */ - if (!diagnostic->option_id.m_idx - || diagnostic->option_id == m_opt_permissive) + if (!diagnostic->m_option_id.m_idx + || diagnostic->m_option_id == m_opt_permissive) return true; /* This tests if the user provided the appropriate -Wfoo or -Wno-foo option. */ - if (!option_enabled_p (diagnostic->option_id)) + if (!option_enabled_p (diagnostic->m_option_id)) return false; /* This tests for #pragma diagnostic changes. */ @@ -1327,20 +1327,20 @@ diagnostic_context::diagnostic_enabled (diagnostic_info *diagnostic) /* This tests if the user provided the appropriate -Werror=foo option. */ if (diag_class == DK_UNSPECIFIED - && !option_unspecified_p (diagnostic->option_id)) + && !option_unspecified_p (diagnostic->m_option_id)) { const diagnostic_t new_kind - = m_option_classifier.get_current_override (diagnostic->option_id); + = m_option_classifier.get_current_override (diagnostic->m_option_id); if (new_kind != DK_ANY) /* DK_ANY means the diagnostic is not to be ignored, but we don't want to change it specifically to DK_ERROR or DK_WARNING; we want to preserve whatever the caller has specified. */ - diagnostic->kind = new_kind; + diagnostic->m_kind = new_kind; } /* This allows for future extensions, like temporarily disabling warnings for ranges of source code. */ - if (diagnostic->kind == DK_IGNORED) + if (diagnostic->m_kind == DK_IGNORED) return false; return true; @@ -1357,10 +1357,10 @@ diagnostic_context::warning_enabled_at (location_t loc, rich_location richloc (line_table, loc); diagnostic_info diagnostic = {}; - diagnostic.option_id = option_id; - diagnostic.richloc = &richloc; - diagnostic.message.m_richloc = &richloc; - diagnostic.kind = DK_WARNING; + diagnostic.m_option_id = option_id; + diagnostic.m_richloc = &richloc; + diagnostic.m_message.m_richloc = &richloc; + diagnostic.m_kind = DK_WARNING; return diagnostic_enabled (&diagnostic); } @@ -1416,7 +1416,7 @@ emit_diagnostic_with_group_va (diagnostic_t kind, bool diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) { - diagnostic_t orig_diag_kind = diagnostic->kind; + diagnostic_t orig_diag_kind = diagnostic->m_kind; /* Every call to report_diagnostic should be within a begin_group/end_group pair so that output formats can reliably @@ -1425,8 +1425,8 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) /* Give preference to being able to inhibit warnings, before they get reclassified to something else. */ - bool was_warning = (diagnostic->kind == DK_WARNING - || diagnostic->kind == DK_PEDWARN); + bool was_warning = (diagnostic->m_kind == DK_WARNING + || diagnostic->m_kind == DK_PEDWARN); if (was_warning && m_inhibit_warnings) { inhibit_notes_in_group (); @@ -1436,15 +1436,15 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) if (m_adjust_diagnostic_info) m_adjust_diagnostic_info (this, diagnostic); - if (diagnostic->kind == DK_PEDWARN) + if (diagnostic->m_kind == DK_PEDWARN) { - diagnostic->kind = m_pedantic_errors ? DK_ERROR : DK_WARNING; + diagnostic->m_kind = m_pedantic_errors ? DK_ERROR : DK_WARNING; /* We do this to avoid giving the message for -pedantic-errors. */ - orig_diag_kind = diagnostic->kind; + orig_diag_kind = diagnostic->m_kind; } - if (diagnostic->kind == DK_NOTE && m_inhibit_notes_p) + if (diagnostic->m_kind == DK_NOTE && m_inhibit_notes_p) return false; /* If the user requested that warnings be treated as errors, so be @@ -1452,10 +1452,10 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) individual warnings can be overridden back to warnings with -Wno-error=*. */ if (m_warning_as_error_requested - && diagnostic->kind == DK_WARNING) - diagnostic->kind = DK_ERROR; + && diagnostic->m_kind == DK_WARNING) + diagnostic->m_kind = DK_ERROR; - diagnostic->message.m_data = &diagnostic->x_data; + diagnostic->m_message.m_data = &diagnostic->m_x_data; /* Check to see if the diagnostic is enabled at the location and not disabled by #pragma GCC diagnostic anywhere along the inlining @@ -1466,7 +1466,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) return false; } - if ((was_warning || diagnostic->kind == DK_WARNING) + if ((was_warning || diagnostic->m_kind == DK_WARNING) && ((!m_warn_system_headers && diagnostic->m_iinfo.m_allsyslocs) || m_inhibit_warnings)) @@ -1474,11 +1474,11 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) inlining stack (if there is one) are in system headers. */ return false; - if (diagnostic->kind == DK_NOTE && notes_inhibited_in_group ()) + if (diagnostic->m_kind == DK_NOTE && notes_inhibited_in_group ()) /* Bail for all the notes in the diagnostic_group that started to inhibit notes. */ return false; - if (diagnostic->kind != DK_NOTE && diagnostic->kind != DK_ICE) + if (diagnostic->m_kind != DK_NOTE && diagnostic->m_kind != DK_ICE) check_max_errors (false); if (m_lock > 0) @@ -1486,7 +1486,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) /* If we're reporting an ICE in the middle of some other error, try to flush out the previous error, then let this one through. Don't do this more than once. */ - if ((diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) + if ((diagnostic->m_kind == DK_ICE || diagnostic->m_kind == DK_ICE_NOBT) && m_lock == 1) pp_newline_and_flush (m_reference_printer); else @@ -1498,7 +1498,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) m_lock++; - if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) + if (diagnostic->m_kind == DK_ICE || diagnostic->m_kind == DK_ICE_NOBT) { /* When not checking, ICEs are converted to fatal errors when an error has already occurred. This is counteracted by @@ -1516,17 +1516,17 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) } if (m_internal_error) (*m_internal_error) (this, - diagnostic->message.m_format_spec, - diagnostic->message.m_args_ptr); + diagnostic->m_message.m_format_spec, + diagnostic->m_message.m_args_ptr); } /* Increment the counter for the appropriate diagnostic kind, either within this context, or within the diagnostic_buffer. */ { const diagnostic_t kind_for_count = - ((diagnostic->kind == DK_ERROR && orig_diag_kind == DK_WARNING) + ((diagnostic->m_kind == DK_ERROR && orig_diag_kind == DK_WARNING) ? DK_WERROR - : diagnostic->kind); + : diagnostic->m_kind); diagnostic_counters &counters = (m_diagnostic_buffer ? m_diagnostic_buffer->m_diagnostic_counters @@ -1540,7 +1540,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) sink_->on_begin_group (); m_diagnostic_groups.m_emission_count++; - va_list *orig_args = diagnostic->message.m_args_ptr; + va_list *orig_args = diagnostic->m_message.m_args_ptr; for (auto sink_ : m_sinks) { /* Formatting the message is done per-output-format, @@ -1560,8 +1560,8 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) so that each has its own set to consume. */ va_list copied_args; va_copy (copied_args, *orig_args); - diagnostic->message.m_args_ptr = &copied_args; - pp_format (sink_->get_printer (), &diagnostic->message); + diagnostic->m_message.m_args_ptr = &copied_args; + pp_format (sink_->get_printer (), &diagnostic->m_message); va_end (copied_args); /* Call vfunc in the output format. This is responsible for @@ -1575,29 +1575,29 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic) break; case EXTRA_DIAGNOSTIC_OUTPUT_fixits_v1: print_parseable_fixits (get_file_cache (), - m_reference_printer, diagnostic->richloc, + m_reference_printer, diagnostic->m_richloc, DIAGNOSTICS_COLUMN_UNIT_BYTE, m_tabstop); pp_flush (m_reference_printer); break; case EXTRA_DIAGNOSTIC_OUTPUT_fixits_v2: print_parseable_fixits (get_file_cache (), - m_reference_printer, diagnostic->richloc, + m_reference_printer, diagnostic->m_richloc, DIAGNOSTICS_COLUMN_UNIT_DISPLAY, m_tabstop); pp_flush (m_reference_printer); break; } if (m_diagnostic_buffer == nullptr - || diagnostic->kind == DK_ICE - || diagnostic->kind == DK_ICE_NOBT) - action_after_output (diagnostic->kind); - diagnostic->x_data = nullptr; + || diagnostic->m_kind == DK_ICE + || diagnostic->m_kind == DK_ICE_NOBT) + action_after_output (diagnostic->m_kind); + diagnostic->m_x_data = nullptr; if (m_edit_context_ptr) - if (diagnostic->richloc->fixits_can_be_auto_applied_p ()) + if (diagnostic->m_richloc->fixits_can_be_auto_applied_p ()) if (!m_diagnostic_buffer) - m_edit_context_ptr->add_fixits (diagnostic->richloc); + m_edit_context_ptr->add_fixits (diagnostic->m_richloc); m_lock--; @@ -1696,15 +1696,15 @@ diagnostic_context::diagnostic_impl (rich_location *richloc, { diagnostic_set_info (&diagnostic, gmsgid, ap, richloc, m_permissive ? DK_WARNING : DK_ERROR); - diagnostic.option_id = (option_id.m_idx != -1 ? option_id : m_opt_permissive); + diagnostic.m_option_id = (option_id.m_idx != -1 ? option_id : m_opt_permissive); } else { diagnostic_set_info (&diagnostic, gmsgid, ap, richloc, kind); if (kind == DK_WARNING || kind == DK_PEDWARN) - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; } - diagnostic.metadata = metadata; + diagnostic.m_metadata = metadata; return report_diagnostic (&diagnostic); } @@ -1733,8 +1733,8 @@ diagnostic_context::diagnostic_n_impl (rich_location *richloc, const char *text = ngettext (singular_gmsgid, plural_gmsgid, gtn); diagnostic_set_info_translated (&diagnostic, text, ap, richloc, kind); if (kind == DK_WARNING) - diagnostic.option_id = option_id; - diagnostic.metadata = metadata; + diagnostic.m_option_id = option_id; + diagnostic.m_metadata = metadata; return report_diagnostic (&diagnostic); } diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 43732bba3218..3bf51aab7ce5 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -158,26 +158,31 @@ enum diagnostic_text_art_charset struct diagnostic_info { diagnostic_info () - : message (), richloc (), metadata (), x_data (), kind (), option_id (), - m_iinfo () + : m_message (), + m_richloc (), + m_metadata (), + m_x_data (), + m_kind (), + m_option_id (), + m_iinfo () { } /* Text to be formatted. */ - text_info message; + text_info m_message; /* The location at which the diagnostic is to be reported. */ - rich_location *richloc; + rich_location *m_richloc; /* An optional bundle of metadata associated with the diagnostic (or NULL). */ - const diagnostics::metadata *metadata; + const diagnostics::metadata *m_metadata; /* Auxiliary data for client. */ - void *x_data; + void *m_x_data; /* The kind of diagnostic it is about. */ - diagnostic_t kind; + diagnostic_t m_kind; /* Which OPT_* directly controls this diagnostic. */ - diagnostic_option_id option_id; + diagnostic_option_id m_option_id; /* Inlining context containing locations for each call site along the inlining stack. */ @@ -1153,7 +1158,7 @@ diagnostic_text_finalizer (diagnostic_context *context) /* Extension hooks for client. */ #define diagnostic_context_auxiliary_data(DC) (DC)->m_client_aux_data -#define diagnostic_info_auxiliary_data(DI) (DI)->x_data +#define diagnostic_info_auxiliary_data(DI) (DI)->m_x_data /* This diagnostic_context is used by front-ends that directly output diagnostic messages without going through `error', `warning', @@ -1182,7 +1187,7 @@ inline void diagnostic_set_option_id (diagnostic_info *info, diagnostic_option_id option_id) { - info->option_id = option_id; + info->m_option_id = option_id; } /* Diagnostic related functions. */ @@ -1335,7 +1340,7 @@ int get_terminal_width (void); inline location_t diagnostic_location (const diagnostic_info * diagnostic, int which = 0) { - return diagnostic->message.get_location (which); + return diagnostic->m_message.get_location (which); } /* Return the number of locations to be printed in DIAGNOSTIC. */ @@ -1343,7 +1348,7 @@ diagnostic_location (const diagnostic_info * diagnostic, int which = 0) inline unsigned int diagnostic_num_locations (const diagnostic_info * diagnostic) { - return diagnostic->message.m_richloc->get_num_locations (); + return diagnostic->m_message.m_richloc->get_num_locations (); } /* Expand the location of this diagnostic. Use this function for @@ -1353,7 +1358,7 @@ diagnostic_num_locations (const diagnostic_info * diagnostic) inline expanded_location diagnostic_expand_location (const diagnostic_info * diagnostic, int which = 0) { - return diagnostic->richloc->get_expanded_location (which); + return diagnostic->m_richloc->get_expanded_location (which); } /* This is somehow the right-side margin of a caret line, that is, we diff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc index 2075a6cf71b5..5b80de15a633 100644 --- a/gcc/diagnostics/html-sink.cc +++ b/gcc/diagnostics/html-sink.cc @@ -499,7 +499,7 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, html_sink_buffer *buffer) { - if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT) + if (diagnostic.m_kind == DK_ICE || diagnostic.m_kind == DK_ICE_NOBT) { /* Print a header for the remaining output to stderr, and return, attempting to print the usual ICE messages to @@ -970,7 +970,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, diag_element->set_attr ("id", diag_id); if (alert) diag_element->set_attr ("class", - get_pf_class_for_alert_div (diagnostic.kind)); + get_pf_class_for_alert_div (diagnostic.m_kind)); xml::printer xp (*diag_element.get ()); const size_t depth_within_alert_div = 1; @@ -980,7 +980,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, if (alert) { xp.push_tag_with_class ("span", - get_pf_class_for_alert_icon (diagnostic.kind), + get_pf_class_for_alert_icon (diagnostic.m_kind), true); xp.add_text (" "); xp.pop_tag ("span"); @@ -1004,7 +1004,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, if (show_severity) { xp.push_tag ("strong"); - xp.add_text (_(get_diagnostic_kind_text (diagnostic.kind))); + xp.add_text (_(get_diagnostic_kind_text (diagnostic.m_kind))); xp.pop_tag ("strong"); xp.add_text (" "); } @@ -1017,21 +1017,21 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, pp_clear_output_area (m_printer); // Add any metadata as a suffix to the message - if (diagnostic.metadata) + if (diagnostic.m_metadata) { xp.add_text (" "); - xp.append (make_element_for_metadata (*diagnostic.metadata)); + xp.append (make_element_for_metadata (*diagnostic.m_metadata)); } // Add any option as a suffix to the message label_text option_text = label_text::take - (m_context.make_option_name (diagnostic.option_id, - orig_diag_kind, diagnostic.kind)); + (m_context.make_option_name (diagnostic.m_option_id, + orig_diag_kind, diagnostic.m_kind)); if (option_text.get ()) { label_text option_url = label_text::take - (m_context.make_option_url (diagnostic.option_id)); + (m_context.make_option_url (diagnostic.m_option_id)); xp.add_text (" "); auto option_span = make_span ("gcc-option"); @@ -1102,9 +1102,9 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, // TODO: m_context.m_last_location should be moved into the sink location_t saved = m_context.m_last_location; m_context.m_last_location = m_last_location; - m_context.maybe_show_locus_as_html (*diagnostic.richloc, + m_context.maybe_show_locus_as_html (*diagnostic.m_richloc, m_context.m_source_printing, - diagnostic.kind, + diagnostic.m_kind, xp, nullptr, nullptr); @@ -1115,7 +1115,7 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); /* Execution path. */ - if (auto path = diagnostic.richloc->get_path ()) + if (auto path = diagnostic.m_richloc->get_path ()) { xp.push_tag ("div"); xp.set_attr ("id", "execution-path"); @@ -1144,8 +1144,8 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, gcc_assert (xp.get_num_open_tags () == depth_within_alert_div); // Try to display any per-diagnostic graphs - if (diagnostic.metadata) - if (auto ldg = diagnostic.metadata->get_lazy_digraphs ()) + if (diagnostic.m_metadata) + if (auto ldg = diagnostic.m_metadata->get_lazy_digraphs ()) { auto &digraphs = ldg->get_or_create_digraphs (); for (auto &dg : digraphs) @@ -1170,7 +1170,7 @@ std::unique_ptr<xml::element> html_builder::make_element_for_patch (const diagnostic_info &diagnostic) { edit_context ec (m_context.get_file_cache ()); - ec.add_fixits (diagnostic.richloc); + ec.add_fixits (diagnostic.m_richloc); if (char *diff = ec.generate_diff (true)) { if (strlen (diff) > 0) diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc index d8b1d52906f0..fddf3dbdc456 100644 --- a/gcc/diagnostics/sarif-sink.cc +++ b/gcc/diagnostics/sarif-sink.cc @@ -1314,7 +1314,7 @@ sarif_result::on_nested_diagnostic (const diagnostic_info &diagnostic, sometimes these will related to current_function_decl, but often they won't. */ auto location_obj - = builder.make_location_object (this, *diagnostic.richloc, + = builder.make_location_object (this, *diagnostic.m_richloc, logical_locations::key (), diagnostic_artifact_role::result_file); auto message_obj @@ -1845,7 +1845,7 @@ sarif_builder::on_report_diagnostic (const diagnostic_info &diagnostic, { pp_output_formatted_text (m_printer, m_context.get_urlifier ()); - if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT) + if (diagnostic.m_kind == DK_ICE || diagnostic.m_kind == DK_ICE_NOBT) { std::unique_ptr<json::object> stack = make_stack_from_backtrace (); m_invocation_obj->add_notification_for_ice (diagnostic, *this, @@ -1995,8 +1995,8 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, /* "ruleId" property (SARIF v2.1.0 section 3.27.5). */ /* Ideally we'd have an option_name for these. */ if (char *option_text - = m_context.make_option_name (diagnostic.option_id, - orig_diag_kind, diagnostic.kind)) + = m_context.make_option_name (diagnostic.m_option_id, + orig_diag_kind, diagnostic.m_kind)) { /* Lazily create reportingDescriptor objects for and add to m_rules_arr. Set ruleId referencing them. */ @@ -2026,10 +2026,10 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, free (rule_id); } - if (diagnostic.metadata) + if (diagnostic.m_metadata) { /* "taxa" property (SARIF v2.1.0 section 3.27.8). */ - if (int cwe_id = diagnostic.metadata->get_cwe ()) + if (int cwe_id = diagnostic.m_metadata->get_cwe ()) { auto taxa_arr = std::make_unique<json::array> (); taxa_arr->append<sarif_reporting_descriptor_reference> @@ -2037,13 +2037,13 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, result_obj->set<json::array> ("taxa", std::move (taxa_arr)); } - diagnostic.metadata->maybe_add_sarif_properties (*result_obj); + diagnostic.m_metadata->maybe_add_sarif_properties (*result_obj); /* We don't yet support diagnostics::metadata::rule. */ } /* "level" property (SARIF v2.1.0 section 3.27.10). */ - if (const char *sarif_level = maybe_get_sarif_level (diagnostic.kind)) + if (const char *sarif_level = maybe_get_sarif_level (diagnostic.m_kind)) result_obj->set_string ("level", sarif_level); /* "message" property (SARIF v2.1.0 section 3.27.11). */ @@ -2060,7 +2060,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, diagnostic_artifact_role::result_file)); /* "codeFlows" property (SARIF v2.1.0 section 3.27.18). */ - if (const paths::path *path = diagnostic.richloc->get_path ()) + if (const paths::path *path = diagnostic.m_richloc->get_path ()) { auto code_flows_arr = std::make_unique<json::array> (); const unsigned code_flow_index = 0; @@ -2072,8 +2072,8 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, } // "graphs" property (SARIF v2.1.0 section 3.27.19). */ - if (diagnostic.metadata) - if (auto ldg = diagnostic.metadata->get_lazy_digraphs ()) + if (diagnostic.m_metadata) + if (auto ldg = diagnostic.m_metadata->get_lazy_digraphs ()) { auto &digraphs = ldg->get_or_create_digraphs (); auto graphs_arr = std::make_unique<json::array> (); @@ -2089,7 +2089,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic, group. */ /* "fixes" property (SARIF v2.1.0 section 3.27.30). */ - const rich_location *richloc = diagnostic.richloc; + const rich_location *richloc = diagnostic.m_richloc; if (richloc->get_num_fixit_hints ()) { auto fix_arr = std::make_unique<json::array> (); @@ -2118,7 +2118,7 @@ make_reporting_descriptor_object_for_warning (const diagnostic_info &diagnostic, it seems redundant compared to "id". */ /* "helpUri" property (SARIF v2.1.0 section 3.49.12). */ - if (char *option_url = m_context.make_option_url (diagnostic.option_id)) + if (char *option_url = m_context.make_option_url (diagnostic.m_option_id)) { reporting_desc->set_string ("helpUri", option_url); free (option_url); @@ -2211,7 +2211,7 @@ sarif_builder::make_locations_arr (sarif_location_manager &loc_mgr, logical_loc = client_data_hooks->get_current_logical_location (); auto location_obj - = make_location_object (&loc_mgr, *diagnostic.richloc, logical_loc, role); + = make_location_object (&loc_mgr, *diagnostic.m_richloc, logical_loc, role); /* Don't add entirely empty location objects to the array. */ if (!location_obj->is_empty ()) locations_arr->append<sarif_location> (std::move (location_obj)); diff --git a/gcc/diagnostics/text-sink.cc b/gcc/diagnostics/text-sink.cc index 67da98cec0d8..e3206dfb7050 100644 --- a/gcc/diagnostics/text-sink.cc +++ b/gcc/diagnostics/text-sink.cc @@ -277,7 +277,7 @@ void text_sink:: after_diagnostic (const diagnostic_info &diagnostic) { - if (const paths::path *path = diagnostic.richloc->get_path ()) + if (const paths::path *path = diagnostic.m_richloc->get_path ()) print_path (*path); } @@ -291,13 +291,13 @@ after_diagnostic (const diagnostic_info &diagnostic) char * text_sink::build_prefix (const diagnostic_info &diagnostic) const { - gcc_assert (diagnostic.kind < DK_LAST_DIAGNOSTIC_KIND); + gcc_assert (diagnostic.m_kind < DK_LAST_DIAGNOSTIC_KIND); - const char *text = _(get_diagnostic_kind_text (diagnostic.kind)); + const char *text = _(get_diagnostic_kind_text (diagnostic.m_kind)); const char *text_cs = "", *text_ce = ""; pretty_printer *pp = get_printer (); - if (const char *color_name = diagnostic_get_color_for_kind (diagnostic.kind)) + if (const char *color_name = diagnostic_get_color_for_kind (diagnostic.m_kind)) { text_cs = colorize_start (pp_show_color (pp), color_name); text_ce = colorize_stop (pp_show_color (pp)); @@ -310,7 +310,7 @@ text_sink::build_prefix (const diagnostic_info &diagnostic) const /* Reduce verbosity of nested diagnostics by not printing "note: " all the time. */ - if (diagnostic.kind == DK_NOTE) + if (diagnostic.m_kind == DK_NOTE) return indent_prefix; char *result = build_message_string ("%s%s%s%s", indent_prefix, @@ -425,7 +425,7 @@ text_sink::append_note (location_t location, pretty_printer *pp = get_printer (); char *saved_prefix = pp_take_prefix (pp); pp_set_prefix (pp, build_prefix (diagnostic)); - pp_format (pp, &diagnostic.message); + pp_format (pp, &diagnostic.m_message); pp_output_formatted_text (pp); pp_destroy_prefix (pp); pp_set_prefix (pp, saved_prefix); @@ -469,16 +469,16 @@ text_sink::update_printer () void text_sink::print_any_cwe (const diagnostic_info &diagnostic) { - if (!diagnostic.metadata) + if (!diagnostic.m_metadata) return; - int cwe = diagnostic.metadata->get_cwe (); + int cwe = diagnostic.m_metadata->get_cwe (); if (cwe) { pretty_printer * const pp = get_printer (); char *saved_prefix = pp_take_prefix (pp); pp_string (pp, " ["); - const char *kind_color = diagnostic_get_color_for_kind (diagnostic.kind); + const char *kind_color = diagnostic_get_color_for_kind (diagnostic.m_kind); pp_string (pp, colorize_start (pp_show_color (pp), kind_color)); if (pp->supports_urls_p ()) { @@ -504,20 +504,20 @@ text_sink::print_any_cwe (const diagnostic_info &diagnostic) void text_sink::print_any_rules (const diagnostic_info &diagnostic) { - if (!diagnostic.metadata) + if (!diagnostic.m_metadata) return; - for (unsigned idx = 0; idx < diagnostic.metadata->get_num_rules (); idx++) + for (unsigned idx = 0; idx < diagnostic.m_metadata->get_num_rules (); idx++) { const diagnostics::metadata::rule &rule - = diagnostic.metadata->get_rule (idx); + = diagnostic.m_metadata->get_rule (idx); if (char *desc = rule.make_description ()) { pretty_printer * const pp = get_printer (); char *saved_prefix = pp_take_prefix (pp); pp_string (pp, " ["); const char *kind_color - = diagnostic_get_color_for_kind (diagnostic.kind); + = diagnostic_get_color_for_kind (diagnostic.m_kind); pp_string (pp, colorize_start (pp_show_color (pp), kind_color)); char *url = nullptr; if (pp->supports_urls_p ()) @@ -548,15 +548,15 @@ text_sink::print_option_information (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind) { if (char *option_text - = m_context.make_option_name (diagnostic.option_id, - orig_diag_kind, diagnostic.kind)) + = m_context.make_option_name (diagnostic.m_option_id, + orig_diag_kind, diagnostic.m_kind)) { char *option_url = nullptr; pretty_printer * const pp = get_printer (); if (pp->supports_urls_p ()) - option_url = m_context.make_option_url (diagnostic.option_id); + option_url = m_context.make_option_url (diagnostic.m_option_id); pp_string (pp, " ["); - const char *kind_color = diagnostic_get_color_for_kind (diagnostic.kind); + const char *kind_color = diagnostic_get_color_for_kind (diagnostic.m_kind); pp_string (pp, colorize_start (pp_show_color (pp), kind_color)); if (option_url) pp_begin_url (pp, option_url); @@ -718,7 +718,7 @@ default_text_finalizer (text_sink &text_output, pp_newline (pp); diagnostic_show_locus (&text_output.get_context (), text_output.get_source_printing_options (), - diagnostic->richloc, diagnostic->kind, pp); + diagnostic->m_richloc, diagnostic->m_kind, pp); pp_set_prefix (pp, saved_prefix); pp_flush (pp); } diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc index 98c67fd952ff..a088d761adff 100644 --- a/gcc/fortran/error.cc +++ b/gcc/fortran/error.cc @@ -273,7 +273,7 @@ gfc_warning (int opt, const char *gmsgid, va_list ap) diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_WARNING); - diagnostic.option_id = opt; + diagnostic.m_option_id = opt; bool ret = gfc_report_diagnostic (&diagnostic); if (buffered_p) @@ -441,7 +441,7 @@ gfc_format_decoder (pretty_printer *pp, text_info *text, const char *spec, const char *color = (loc_num ? "range1" - : diagnostic_get_color_for_kind (curr_diagnostic->kind)); + : diagnostic_get_color_for_kind (curr_diagnostic->m_kind)); pp_string (pp, colorize_start (pp_show_color (pp), color)); pp_string (pp, result[loc_num]); pp_string (pp, colorize_stop (pp_show_color (pp))); @@ -475,15 +475,15 @@ gfc_diagnostic_build_kind_prefix (diagnostic_context *context, #undef DEFINE_DIAGNOSTIC_KIND NULL }; - gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND); - const char *text = _(diagnostic_kind_text[diagnostic->kind]); + gcc_assert (diagnostic->m_kind < DK_LAST_DIAGNOSTIC_KIND); + const char *text = _(diagnostic_kind_text[diagnostic->m_kind]); const char *text_cs = "", *text_ce = ""; pretty_printer *const pp = context->get_reference_printer (); - if (diagnostic_kind_color[diagnostic->kind]) + if (diagnostic_kind_color[diagnostic->m_kind]) { text_cs = colorize_start (pp_show_color (pp), - diagnostic_kind_color[diagnostic->kind]); + diagnostic_kind_color[diagnostic->m_kind]); text_ce = colorize_stop (pp_show_color (pp)); } return build_message_string ("%s%s:%s ", text_cs, text, text_ce); @@ -557,7 +557,7 @@ gfc_diagnostic_text_starter (diagnostics::text_sink &text_output, expanded_location s1 = diagnostic_expand_location (diagnostic); expanded_location s2; - bool one_locus = diagnostic->richloc->get_num_locations () < 2; + bool one_locus = diagnostic->m_richloc->get_num_locations () < 2; bool same_locus = false; if (!one_locus) @@ -608,7 +608,7 @@ gfc_diagnostic_text_starter (diagnostics::text_sink &text_output, pp_newline (pp); diagnostic_show_locus (context, text_output.get_source_printing_options (), - diagnostic->richloc, diagnostic->kind, + diagnostic->m_richloc, diagnostic->m_kind, pp); /* If the caret line was shown, the prefix does not contain the locus. */ @@ -656,7 +656,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_id = opt; + diagnostic.m_option_id = opt; ret = gfc_report_diagnostic (&diagnostic); va_end (argp); return ret; @@ -675,7 +675,7 @@ gfc_warning_now (int opt, const char *gmsgid, ...) va_start (argp, gmsgid); diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_WARNING); - diagnostic.option_id = opt; + diagnostic.m_option_id = opt; ret = gfc_report_diagnostic (&diagnostic); va_end (argp); return ret; @@ -694,7 +694,7 @@ gfc_warning_internal (int opt, const char *gmsgid, ...) va_start (argp, gmsgid); diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_WARNING); - diagnostic.option_id = opt; + diagnostic.m_option_id = opt; ret = gfc_report_diagnostic (&diagnostic); va_end (argp); return ret; diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc index 67420c700b6b..a55151dd232a 100644 --- a/gcc/libgdiagnostics.cc +++ b/gcc/libgdiagnostics.cc @@ -1446,8 +1446,8 @@ void diagnostic_text_sink::text_starter (diagnostics::text_sink &text_output, const diagnostic_info *info) { - gcc_assert (info->x_data); - const diagnostic &diag = *static_cast<const diagnostic *> (info->x_data); + gcc_assert (info->m_x_data); + const diagnostic &diag = *static_cast<const diagnostic *> (info->m_x_data); pretty_printer *pp = text_output.get_printer (); const diagnostic_logical_location *diag_logical_loc = diag.get_logical_location (); @@ -1617,8 +1617,8 @@ GCC_DIAGNOSTIC_PUSH_IGNORED(-Wsuggest-attribute=format) diagnostic_set_info (&info, msgid, args, diag.get_rich_location (), diagnostic_t_from_diagnostic_level (diag.get_level ())); GCC_DIAGNOSTIC_POP - info.metadata = diag.get_metadata (); - info.x_data = &diag; + info.m_metadata = diag.get_metadata (); + info.m_x_data = &diag; diagnostic_report_diagnostic (&m_dc, &info); m_dc.end_group (); diff --git a/gcc/substring-locations.cc b/gcc/substring-locations.cc index 78ce72268754..990a8bd79fe1 100644 --- a/gcc/substring-locations.cc +++ b/gcc/substring-locations.cc @@ -223,7 +223,7 @@ format_string_diagnostic_t::emit_warning_n_va (diagnostic_option_id option_id, else diagnostic_set_info (&diagnostic, singular_gmsgid, ap, &richloc, DK_WARNING); - diagnostic.option_id = option_id; + diagnostic.m_option_id = option_id; bool warned = diagnostic_report_diagnostic (global_dc, &diagnostic); if (!err && fmt_substring_loc && !substring_within_range) 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 4d2057c5e602..d22e73a730a9 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 @@ -143,7 +143,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->richloc, diagnostic->kind, pp); + diagnostic->m_richloc, diagnostic->m_kind, pp); pp_show_color (pp) = old_show_color; pp_set_prefix (pp, saved_prefix); pp_flush (pp); diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc index 3f706ac04f00..b2435df46b32 100644 --- a/gcc/tree-diagnostic.cc +++ b/gcc/tree-diagnostic.cc @@ -169,7 +169,7 @@ set_inlining_locations (diagnostic_context *, /* Set if all locations are in a system header. */ diagnostic->m_iinfo.m_allsyslocs = nsyslocs == ilocs.length (); - if (tree *ao = pp_ti_abstract_origin (&diagnostic->message)) + if (tree *ao = pp_ti_abstract_origin (&diagnostic->m_message)) *ao = (tree)diagnostic->m_iinfo.m_ao; } -- 2.26.3