https://gcc.gnu.org/g:aecf348fc7920e0a3d7119aa1fd16fddef964928
commit r17-5513-gaecf348fc7920e0a3d7119aa1fd16fddef964928 Author: David Malcolm <[email protected]> Date: Fri Oct 23 10:40:36 2026 -0400 diagnostics: fix terminology in comment No functional change intended. gcc/ChangeLog: * diagnostics/context.cc (context::report_diagnostic): Update comment to refer to "diagnostic sinks" rather than "output formats". Signed-off-by: David Malcolm <[email protected]> Diff: --- gcc/diagnostics/context.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc index 98af6ecb1b66..20692160679a 100644 --- a/gcc/diagnostics/context.cc +++ b/gcc/diagnostics/context.cc @@ -1509,28 +1509,28 @@ context::report_diagnostic (diagnostic_info *diagnostic) va_list *orig_args = diagnostic->m_message.m_args_ptr; for (auto sink_ : m_sinks) { - /* Formatting the message is done per-output-format, - so that each output format gets its own set of pp_token_lists + /* Formatting the message is done per-diagnostic-sink + so that each diagnostic sink gets its own set of pp_token_lists to work with. Run phases 1 and 2 of formatting the message before calling - the format's on_report_diagnostic. + the sink's on_report_diagnostic. In particular, some format codes may have side-effects here which - need to happen before sending the diagnostic to the output format. + need to happen before sending the diagnostic to the diagnostic sink. For example, Fortran's %C and %L formatting codes populate the rich_location. Such side-effects must be idempotent, since they are run per - output-format. + diagnostic sink. Make a duplicate of the varargs for each call to pp_format, - so that each has its own set to consume. */ + so that each sink has its own set to consume. */ va_list copied_args; va_copy (copied_args, *orig_args); 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 + /* Call vfunc in the diagnostic sink. This is responsible for phase 3 of formatting, and for printing the result. */ sink_->on_report_diagnostic (*diagnostic, orig_diag_kind); }
