]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostics: require callers of diagnostic_show_locus to be explicit about the printe...
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 30 Sep 2024 15:48:30 +0000 (11:48 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 30 Sep 2024 15:48:30 +0000 (11:48 -0400)
commite7a8fbe2fed83b5ce6e2bdb6fd66d9bf47f74db7
tree57804a7bfba3023b89bbce8ce1cb42a7b973b014
parentbe02253af810348be689cfa6f235af96c8cc5802
diagnostics: require callers of diagnostic_show_locus to be explicit about the printer [PR116613]

As work towards supporting multiple diagnostic outputs (where each
output has its own pretty_printer), update diagnostic_show_locus
so that the pretty_printer must always be explicitly passed in.

No functional change intended.

gcc/c-family/ChangeLog:
PR other/116613
* c-format.cc (selftest::test_type_mismatch_range_labels):
Explicitly pass in dc.m_printer to diagnostic_show_locus.

gcc/ChangeLog:
PR other/116613
* diagnostic-show-locus.cc (diagnostic_context::maybe_show_locus):
Convert param "pp" from * to &.  Drop logic for using the
context's m_printer when the param is null.
* diagnostic.h (diagnostic_context::maybe_show_locus): Convert
param "pp" from * to &.
(diagnostic_show_locus): Drop default "nullptr" value for pp
param.  Assert that it and context are nonnull.  Pass pp by
reference to maybe_show_locus.

gcc/testsuite/ChangeLog:
PR other/116613
* gcc.dg/plugin/expensive_selftests_plugin.c (test_richloc):
Explicitly pass in dc.m_printer to diagnostic_show_locus.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/c-family/c-format.cc
gcc/diagnostic-show-locus.cc
gcc/diagnostic.h
gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.c