aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-10-24 11:47:30 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-10-24 11:47:30 -0400
commitfc1a001921c9c37b4d4dcaf180998aefb4037b8e (patch)
treeb8e86619e019a115012230ad369b70ba1f5ed9e1 /gcc
parentcc33531df065c20a52cb0c35637f096978128b46 (diff)
downloadgcc-fc1a001921c9c37b4d4dcaf180998aefb4037b8e.zip
gcc-fc1a001921c9c37b4d4dcaf180998aefb4037b8e.tar.gz
gcc-fc1a001921c9c37b4d4dcaf180998aefb4037b8e.tar.bz2
Add comment about pp_format to diagnostic_context::report_diagnostic
No functional change intended. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::report_diagnostic): Add comment about interaction of this code with pretty-print formatting phaes. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/diagnostic.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index f1cfb3a..7123008 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -1341,7 +1341,14 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic)
m_output_format->on_begin_group ();
m_diagnostic_groups.m_emission_count++;
+ /* Run phases 1 and 2 of formatting the message.
+ In particular, some format codes may have side-effects here which need to
+ happen before sending the diagnostic to the output format.
+
+ For example, Fortran's %C and %L formatting codes populate the
+ rich_location. */
pp_format (m_printer, &diagnostic->message);
+
/* Call vfunc in the output format. This is responsible for
phase 3 of formatting, and for printing the result. */
m_output_format->on_report_diagnostic (*diagnostic, orig_diag_kind);