aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-07-25 15:13:45 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-07-25 15:13:45 -0400
commit3568e2f949324efd2e0ee13a3c803cee3e51285a (patch)
tree10ea5d914918ba303646e5dfc08d0724de6e1a1a /gcc
parent24ffe3ea649d07f8fb4d14b89b61bf9e174069fd (diff)
downloadgcc-3568e2f949324efd2e0ee13a3c803cee3e51285a.zip
gcc-3568e2f949324efd2e0ee13a3c803cee3e51285a.tar.gz
gcc-3568e2f949324efd2e0ee13a3c803cee3e51285a.tar.bz2
diagnostics: make context::m_source_printing private
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Make diagnostics::context::m_source_printing private. gcc/analyzer/ChangeLog: * program-point.cc: Make diagnostics::context::m_source_printing private. gcc/c-family/ChangeLog: * c-common.cc: Make diagnostics::context::m_source_printing private. * c-format.cc: Likewise. * c-opts.cc: Likewise. gcc/ChangeLog: * diagnostic.h (diagnostic_set_caret_max_width): Drop forward decl. (diagnostic_same_line): Make diagnostics::context::m_source_printing private. * diagnostics/context.cc (diagnostic_set_caret_max_width): Convert to... (diagnostics::context::set_caret_max_width): ...this. * diagnostics/context.h (diagnostics::context::get_source_printing_options): New accessors. (diagnostics::context::m_source_printing): Make private. * diagnostics/html-sink.cc: Make diagnostics::context::m_source_printing private. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h (diagnostics::selftest::test_context::colorize_source): New. (diagnostics::selftest::test_context::show_labels): New. (diagnostics::selftest::test_context::show_line_numbers): New. (diagnostics::selftest::test_context::show_ruler): New. (diagnostics::selftest::test_context::show_event_links): New. (diagnostics::selftest::test_context::set_caret_char): New. * diagnostics/source-printing.cc: Make diagnostics::context::m_source_printing private. * diagnostics/text-sink.h: Likewise. * libgdiagnostics.cc: Likewise. * opts.cc: Likewise. * toplev.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Make diagnostics::context::m_source_printing private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_show_trees.cc: Make diagnostics::context::m_source_printing private. * gcc.dg/plugin/diagnostic_plugin_test_inlining.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/misc.cc2
-rw-r--r--gcc/analyzer/program-point.cc5
-rw-r--r--gcc/c-family/c-common.cc2
-rw-r--r--gcc/c-family/c-format.cc2
-rw-r--r--gcc/c-family/c-opts.cc2
-rw-r--r--gcc/diagnostic.h5
-rw-r--r--gcc/diagnostics/context.cc13
-rw-r--r--gcc/diagnostics/context.h15
-rw-r--r--gcc/diagnostics/html-sink.cc13
-rw-r--r--gcc/diagnostics/paths-output.cc44
-rw-r--r--gcc/diagnostics/sarif-sink.cc9
-rw-r--r--gcc/diagnostics/selftest-context.cc10
-rw-r--r--gcc/diagnostics/selftest-context.h28
-rw-r--r--gcc/diagnostics/source-printing.cc87
-rw-r--r--gcc/diagnostics/text-sink.h2
-rw-r--r--gcc/fortran/error.cc12
-rw-r--r--gcc/libgdiagnostics.cc13
-rw-r--r--gcc/opts.cc12
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc26
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc2
-rw-r--r--gcc/toplev.cc11
26 files changed, 191 insertions, 134 deletions
diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 6de9b42..7711f8b 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -271,7 +271,7 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
/* No caret by default for Ada. */
if (!OPTION_SET_P (flag_diagnostics_show_caret))
- global_dc->m_source_printing.enabled = false;
+ global_dc->get_source_printing_options ().enabled = false;
/* Copy global settings to local versions. */
gnat_encodings = global_options.x_gnat_encodings;
diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index a07d3c8..9baa007 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -243,8 +243,9 @@ public:
debug_diagnostic_context ()
{
diagnostic_initialize (this, 0);
- m_source_printing.show_line_numbers_p = true;
- m_source_printing.enabled = true;
+ auto &source_printing_opts = get_source_printing_options ();
+ source_printing_opts.show_line_numbers_p = true;
+ source_printing_opts.enabled = true;
}
~debug_diagnostic_context ()
{
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 07059dc..e7dd460 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -10114,7 +10114,7 @@ maybe_add_include_fixit (rich_location *richloc, const char *header,
richloc->add_fixit_insert_before (include_insert_loc, text);
free (text);
- if (override_location && global_dc->m_source_printing.enabled)
+ if (override_location && global_dc->get_source_printing_options ().enabled)
{
/* Replace the primary location with that of the insertion point for the
fix-it hint.
diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc
index c8e00b2..bf144d0 100644
--- a/gcc/c-family/c-format.cc
+++ b/gcc/c-family/c-format.cc
@@ -5588,7 +5588,7 @@ test_type_mismatch_range_labels ()
diagnostics::selftest::test_context dc;
diagnostic_show_locus (&dc,
- dc.m_source_printing,
+ dc.get_source_printing_options (),
&richloc,
diagnostics::kind::error,
dc.get_reference_printer ());
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 2ce05e5..c652e82 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -278,7 +278,7 @@ c_common_init_options (unsigned int decoded_options_count,
if (c_dialect_cxx ())
set_std_cxx17 (/*ISO*/false);
- global_dc->m_source_printing.colorize_source_p = true;
+ global_dc->get_source_printing_options ().colorize_source_p = true;
}
/* Handle switch SCODE with argument ARG. VALUE is true, unless no-
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index d22d77b..1704847 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -206,8 +206,6 @@ void default_text_finalizer (diagnostics::text_sink &,
enum diagnostics::kind);
} // namespace diagnostics
-void diagnostic_set_caret_max_width (diagnostics::context *context, int value);
-
int get_terminal_width (void);
/* Return the location associated to this diagnostic. Parameter WHICH
@@ -253,7 +251,8 @@ diagnostic_same_line (const diagnostics::context *context,
expanded_location s1, expanded_location s2)
{
return (s2.column && s1.line == s2.line
- && (context->m_source_printing.max_width - CARET_LINE_MARGIN
+ && ((context->get_source_printing_options ().max_width
+ - CARET_LINE_MARGIN)
> abs (s1.column - s2.column)));
}
diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc
index 842baed..e8a87c8 100644
--- a/gcc/diagnostics/context.cc
+++ b/gcc/diagnostics/context.cc
@@ -112,23 +112,24 @@ get_terminal_width (void)
return INT_MAX;
}
+namespace diagnostics {
+
/* Set caret_max_width to value. */
+
void
-diagnostic_set_caret_max_width (diagnostics::context *context, int value)
+context::set_caret_max_width (int value)
{
/* One minus to account for the leading empty space. */
value = value ? value - 1
- : (isatty (fileno (pp_buffer (context->get_reference_printer ())->m_stream))
+ : (isatty (fileno (pp_buffer (get_reference_printer ())->m_stream))
? get_terminal_width () - 1 : INT_MAX);
if (value <= 0)
value = INT_MAX;
- context->m_source_printing.max_width = value;
+ m_source_printing.max_width = value;
}
-namespace diagnostics {
-
/* Initialize the diagnostic message outputting machinery. */
void
@@ -144,7 +145,7 @@ context::initialize (int n_opts)
m_n_opts = n_opts;
m_option_classifier.init (n_opts);
m_source_printing.enabled = false;
- diagnostic_set_caret_max_width (this, pp_line_cutoff (get_reference_printer ()));
+ set_caret_max_width (pp_line_cutoff (get_reference_printer ()));
for (int i = 0; i < rich_location::STATICALLY_ALLOCATED_RANGES; i++)
m_source_printing.caret_chars[i] = '^';
m_show_cwe = false;
diff --git a/gcc/diagnostics/context.h b/gcc/diagnostics/context.h
index 835403e..3c0ca4d 100644
--- a/gcc/diagnostics/context.h
+++ b/gcc/diagnostics/context.h
@@ -678,6 +678,19 @@ public:
void
inhibit_notes () { m_inhibit_notes_p = true; }
+ source_printing_options &
+ get_source_printing_options ()
+ {
+ return m_source_printing;
+ }
+ const source_printing_options &
+ get_source_printing_options () const
+ {
+ return m_source_printing;
+ }
+
+ void set_caret_max_width (int value);
+
private:
void error_recursion () ATTRIBUTE_NORETURN;
@@ -822,10 +835,8 @@ private:
bool m_inhibit_notes_p;
-public:
source_printing_options m_source_printing;
-private:
/* True if -freport-bug option is used. */
bool m_report_bug;
diff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc
index a020254..35525cb 100644
--- a/gcc/diagnostics/html-sink.cc
+++ b/gcc/diagnostics/html-sink.cc
@@ -1102,12 +1102,13 @@ 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.m_richloc,
- m_context.m_source_printing,
- diagnostic.m_kind,
- xp,
- nullptr,
- nullptr);
+ m_context.maybe_show_locus_as_html
+ (*diagnostic.m_richloc,
+ m_context.get_source_printing_options (),
+ diagnostic.m_kind,
+ xp,
+ nullptr,
+ nullptr);
m_context.m_last_location = saved;
m_last_location = m_context.m_last_location;
}
diff --git a/gcc/diagnostics/paths-output.cc b/gcc/diagnostics/paths-output.cc
index c132d67..a3ac9a0 100644
--- a/gcc/diagnostics/paths-output.cc
+++ b/gcc/diagnostics/paths-output.cc
@@ -604,7 +604,7 @@ struct event_range
/* Emit a span indicating the filename (and line/column) if the
line has changed relative to the last call to
diagnostic_show_locus. */
- if (dc.m_source_printing.enabled)
+ if (dc.get_source_printing_options ().enabled)
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
@@ -662,7 +662,7 @@ struct event_range
/* Emit a span indicating the filename (and line/column) if the
line has changed relative to the last call to
diagnostic_show_locus. */
- if (dc.m_source_printing.enabled)
+ if (dc.get_source_printing_options ().enabled)
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
@@ -701,7 +701,7 @@ struct event_range
/* Call diagnostic_show_locus_as_html to show the source,
showing events using labels. */
- diagnostic_show_locus_as_html (&dc, dc.m_source_printing,
+ diagnostic_show_locus_as_html (&dc, dc.get_source_printing_options (),
&m_richloc, diagnostics::kind::path, xp,
effect_info, event_label_writer);
@@ -1895,7 +1895,7 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
+ dc.show_event_links (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -1921,7 +1921,7 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = false;
+ dc.show_event_links (false);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -1944,8 +1944,8 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_line_numbers_p = true;
- dc.m_source_printing.show_event_links_p = true;
+ dc.show_line_numbers (true);
+ dc.show_event_links (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -1971,8 +1971,8 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_line_numbers_p = true;
- dc.m_source_printing.show_event_links_p = false;
+ dc.show_line_numbers (true);
+ dc.show_event_links (false);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -1995,7 +1995,7 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_UNICODE);
- dc.m_source_printing.show_event_links_p = true;
+ dc.show_event_links (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2021,8 +2021,8 @@ test_control_flow_1 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_UNICODE);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2093,8 +2093,8 @@ test_control_flow_2 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2181,8 +2181,8 @@ test_control_flow_3 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2240,8 +2240,8 @@ assert_cfg_edge_path_streq (const location &loc,
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2565,8 +2565,8 @@ test_control_flow_5 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
@@ -2655,8 +2655,8 @@ test_control_flow_6 (const line_table_case &case_,
{
selftest::test_context dc;
dc.set_text_art_charset (DIAGNOSTICS_TEXT_ART_CHARSET_ASCII);
- dc.m_source_printing.show_event_links_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_event_links (true);
+ dc.show_line_numbers (true);
text_sink text_output (dc);
path_print_policy policy (text_output);
path_summary summary (policy, *event_pp, path, true);
diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc
index 592a690..74252b4 100644
--- a/gcc/diagnostics/sarif-sink.cc
+++ b/gcc/diagnostics/sarif-sink.cc
@@ -2269,10 +2269,11 @@ sarif_builder::make_location_object (sarif_location_manager *loc_mgr,
{
diagnostics::context dc;
diagnostic_initialize (&dc, 0);
- dc.m_source_printing.enabled = true;
- dc.m_source_printing.colorize_source_p = false;
- dc.m_source_printing.show_labels_p = true;
- dc.m_source_printing.show_line_numbers_p = true;
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.enabled = true;
+ source_printing_opts.colorize_source_p = false;
+ source_printing_opts.show_labels_p = true;
+ source_printing_opts.show_line_numbers_p = true;
rich_location my_rich_loc (m_richloc);
my_rich_loc.set_escape_on_output (true);
diff --git a/gcc/diagnostics/selftest-context.cc b/gcc/diagnostics/selftest-context.cc
index 4f215c2..31dbe82 100644
--- a/gcc/diagnostics/selftest-context.cc
+++ b/gcc/diagnostics/selftest-context.cc
@@ -39,12 +39,14 @@ test_context::test_context ()
{
diagnostic_initialize (this, 0);
pp_show_color (get_reference_printer ()) = false;
- m_source_printing.enabled = true;
- m_source_printing.show_labels_p = true;
+
+ auto &source_printing_opts = get_source_printing_options ();
+ source_printing_opts.enabled = true;
+ source_printing_opts.show_labels_p = true;
m_show_column = true;
start_span (this) = start_span_cb;
- m_source_printing.min_margin_width = 6;
- m_source_printing.max_width = 80;
+ source_printing_opts.min_margin_width = 6;
+ source_printing_opts.max_width = 80;
pp_buffer (get_sink (0).get_printer ())->m_flush_p = false;
}
diff --git a/gcc/diagnostics/selftest-context.h b/gcc/diagnostics/selftest-context.h
index faa81bf..cfba997 100644
--- a/gcc/diagnostics/selftest-context.h
+++ b/gcc/diagnostics/selftest-context.h
@@ -55,6 +55,34 @@ class test_context : public context
const char * fmt, ...) ATTRIBUTE_GCC_DIAG(6,7);
const char *test_show_locus (rich_location &richloc);
+
+ /* Setters for the context's source_printing_options
+ for use in selftests. */
+ void colorize_source (bool val)
+ {
+ get_source_printing_options ().colorize_source_p = val;
+ }
+ void show_labels (bool val)
+ {
+ get_source_printing_options ().show_labels_p = val;
+ }
+ void show_line_numbers (bool val)
+ {
+ get_source_printing_options ().show_line_numbers_p = val;
+ }
+ void show_ruler (bool val)
+ {
+ get_source_printing_options ().show_ruler_p = val;
+ }
+ void show_event_links (bool val)
+ {
+ get_source_printing_options ().show_event_links_p = val;
+ }
+ void set_caret_char (unsigned idx, char ch)
+ {
+ gcc_assert (idx < rich_location::STATICALLY_ALLOCATED_RANGES);
+ get_source_printing_options ().caret_chars[idx] = ch;
+ }
};
} // namespace selftest
diff --git a/gcc/diagnostics/source-printing.cc b/gcc/diagnostics/source-printing.cc
index 9f06728..5e0a57f 100644
--- a/gcc/diagnostics/source-printing.cc
+++ b/gcc/diagnostics/source-printing.cc
@@ -3843,8 +3843,9 @@ add_location_if_nearby (const diagnostics::context &dc,
bool restrict_to_current_line_spans,
const range_label *label)
{
- diagnostics::source_print_policy source_policy (dc,
- dc.m_source_printing);
+ diagnostics::source_print_policy
+ source_policy (dc,
+ dc.get_source_printing_options ());
return add_location_if_nearby (source_policy, loc,
restrict_to_current_line_spans, label);
}
@@ -4057,7 +4058,7 @@ make_element_for_locus (const rich_location &rich_loc,
xml::element wrapper ("wrapper", false);
xml::printer xp (wrapper);
dc.maybe_show_locus_as_html (rich_loc,
- dc.m_source_printing,
+ dc.get_source_printing_options (),
kind,
xp,
nullptr,
@@ -4171,11 +4172,12 @@ test_offset_impl (int caret_byte_col, int max_width,
int left_margin = test_left_margin)
{
test_context dc;
- dc.m_source_printing.max_width = max_width;
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.max_width = max_width;
/* min_margin_width sets the minimum space reserved for
the line number plus one space after. */
- dc.m_source_printing.min_margin_width = left_margin - test_linenum_sep + 1;
- dc.m_source_printing.show_line_numbers_p = true;
+ source_printing_opts.min_margin_width = left_margin - test_linenum_sep + 1;
+ dc.show_line_numbers (true);
diagnostics::source_print_policy source_policy (dc);
rich_location richloc (line_table,
linemap_position_for_column (line_table,
@@ -4287,11 +4289,12 @@ test_layout_x_offset_display_utf8 (const line_table_case &case_)
/* Test that the source line is offset as expected when printed. */
{
test_context dc;
- dc.m_source_printing.max_width = small_width - 6;
- dc.m_source_printing.min_margin_width
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.max_width = small_width - 6;
+ source_printing_opts.min_margin_width
= test_left_margin - test_linenum_sep + 1;
- dc.m_source_printing.show_line_numbers_p = true;
- dc.m_source_printing.show_ruler_p = true;
+ dc.show_line_numbers (true);
+ dc.show_ruler (true);
diagnostics::source_print_policy policy (dc);
rich_location richloc (line_table,
linemap_position_for_column (line_table,
@@ -4317,11 +4320,12 @@ test_layout_x_offset_display_utf8 (const line_table_case &case_)
it with a padding space in this case. */
{
test_context dc;
- dc.m_source_printing.max_width = small_width - 5;
- dc.m_source_printing.min_margin_width
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.max_width = small_width - 5;
+ source_printing_opts.min_margin_width
= test_left_margin - test_linenum_sep + 1;
- dc.m_source_printing.show_line_numbers_p = true;
- dc.m_source_printing.show_ruler_p = true;
+ dc.show_line_numbers (true);
+ dc.show_ruler (true);
diagnostics::source_print_policy policy (dc);
rich_location richloc (line_table,
linemap_position_for_column (line_table,
@@ -4433,10 +4437,11 @@ test_layout_x_offset_display_tab (const line_table_case &case_)
test_context dc;
dc.m_tabstop = tabstop;
static const int small_width = 24;
- dc.m_source_printing.max_width = small_width - 4;
- dc.m_source_printing.min_margin_width
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.max_width = small_width - 4;
+ source_printing_opts.min_margin_width
= test_left_margin - test_linenum_sep + 1;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
diagnostics::source_print_policy policy (dc);
layout test_layout (policy, richloc, nullptr);
colorizer col (*dc.get_reference_printer (),
@@ -4538,7 +4543,7 @@ test_one_liner_caret_and_range ()
}
{
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
auto out = make_raw_html_for_locus (richloc, diagnostics::kind::error, dc);
ASSERT_STREQ
("<table class=\"locus\">\n"
@@ -4561,19 +4566,19 @@ test_one_liner_multiple_carets_and_ranges ()
= make_location (linemap_position_for_column (line_table, 2),
linemap_position_for_column (line_table, 1),
linemap_position_for_column (line_table, 3));
- dc.m_source_printing.caret_chars[0] = 'A';
+ dc.set_caret_char (0, 'A');
location_t bar
= make_location (linemap_position_for_column (line_table, 8),
linemap_position_for_column (line_table, 7),
linemap_position_for_column (line_table, 9));
- dc.m_source_printing.caret_chars[1] = 'B';
+ dc.set_caret_char (1, 'B');
location_t field
= make_location (linemap_position_for_column (line_table, 13),
linemap_position_for_column (line_table, 11),
linemap_position_for_column (line_table, 15));
- dc.m_source_printing.caret_chars[2] = 'C';
+ dc.set_caret_char (2, 'C');
rich_location richloc (line_table, foo);
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
@@ -4651,8 +4656,9 @@ test_one_liner_fixit_remove ()
/* Normal, with ruler. */
{
test_context dc;
- dc.m_source_printing.show_ruler_p = true;
- dc.m_source_printing.max_width = 104;
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ dc.show_ruler (true);
+ source_printing_opts.max_width = 104;
ASSERT_STREQ (" 0 0 0 0 0 0 0 0 0 1 \n"
" 1 2 3 4 5 6 7 8 9 0 \n"
" 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\n"
@@ -4665,8 +4671,9 @@ test_one_liner_fixit_remove ()
/* Test of adding a prefix, with ruler. */
{
test_context dc;
- dc.m_source_printing.show_ruler_p = true;
- dc.m_source_printing.max_width = 50;
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ dc.show_ruler (true);
+ source_printing_opts.max_width = 50;
pp_prefixing_rule (dc.get_reference_printer ()) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.get_reference_printer (), xstrdup ("TEST PREFIX:"));
ASSERT_STREQ ("TEST PREFIX: 1 2 3 4 5\n"
@@ -4680,9 +4687,10 @@ test_one_liner_fixit_remove ()
/* Test of adding a prefix, with ruler and line numbers. */
{
test_context dc;
- dc.m_source_printing.show_ruler_p = true;
- dc.m_source_printing.max_width = 50;
- dc.m_source_printing.show_line_numbers_p = true;
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ dc.show_ruler (true);
+ source_printing_opts.max_width = 50;
+ dc.show_line_numbers (true);
pp_prefixing_rule (dc.get_reference_printer ()) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.get_reference_printer (), xstrdup ("TEST PREFIX:"));
ASSERT_STREQ ("TEST PREFIX: | 1 2 3 4 5\n"
@@ -4942,7 +4950,7 @@ test_one_liner_labels ()
/* Verify that we can disable label-printing. */
{
test_context dc;
- dc.m_source_printing.show_labels_p = false;
+ dc.show_labels (false);
ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n",
dc.test_show_locus (richloc));
@@ -4969,7 +4977,7 @@ test_one_liner_labels ()
{
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
auto out
= make_raw_html_for_locus (richloc, diagnostics::kind::error, dc);
ASSERT_STREQ
@@ -5195,19 +5203,19 @@ test_one_liner_multiple_carets_and_ranges_utf8 ()
= make_location (linemap_position_for_column (line_table, 7),
linemap_position_for_column (line_table, 1),
linemap_position_for_column (line_table, 8));
- dc.m_source_printing.caret_chars[0] = 'A';
+ dc.set_caret_char (0, 'A');
location_t bar
= make_location (linemap_position_for_column (line_table, 16),
linemap_position_for_column (line_table, 12),
linemap_position_for_column (line_table, 17));
- dc.m_source_printing.caret_chars[1] = 'B';
+ dc.set_caret_char (1, 'B');
location_t field
= make_location (linemap_position_for_column (line_table, 26),
linemap_position_for_column (line_table, 19),
linemap_position_for_column (line_table, 30));
- dc.m_source_printing.caret_chars[2] = 'C';
+ dc.set_caret_char (2, 'C');
rich_location richloc (line_table, foo);
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
richloc.add_range (field, SHOW_RANGE_WITH_CARET);
@@ -5674,7 +5682,7 @@ static void
test_one_liner_colorized_utf8 ()
{
test_context dc;
- dc.m_source_printing.colorize_source_p = true;
+ dc.colorize_source (true);
diagnostic_color_init (&dc, DIAGNOSTICS_COLOR_YES);
const location_t pi = linemap_position_for_column (line_table, 12);
rich_location richloc (line_table, pi);
@@ -5892,7 +5900,7 @@ test_diagnostic_show_locus_fixit_lines (const line_table_case &case_)
richloc.add_fixit_insert_before (y, ".");
richloc.add_fixit_replace (colon, "=");
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
ASSERT_STREQ (" 3 | y\n"
" | .\n"
"......\n"
@@ -6621,7 +6629,7 @@ test_fixit_insert_containing_newline (const line_table_case &case_)
/* With line numbers. */
{
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
ASSERT_STREQ (" 2 | x = a;\n"
" +++ |+ break;\n"
" 3 | case 'b':\n"
@@ -6697,7 +6705,7 @@ test_fixit_insert_containing_newline_2 (const line_table_case &case_)
consolidated, since it makes little sense to skip line 2. */
{
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
+ dc.show_line_numbers (true);
ASSERT_STREQ (" +++ |+#include <stdio.h>\n"
" 1 | test (int ch)\n"
" 2 | {\n"
@@ -6980,8 +6988,9 @@ test_line_numbers_multiline_range ()
location_t loc = make_location (caret, start, finish);
test_context dc;
- dc.m_source_printing.show_line_numbers_p = true;
- dc.m_source_printing.min_margin_width = 0;
+ dc.show_line_numbers (true);
+ auto &source_printing_opts = dc.get_source_printing_options ();
+ source_printing_opts.min_margin_width = 0;
gcc_rich_location richloc (loc);
ASSERT_STREQ (" 9 | this is line 9\n"
" | ~~~~~~\n"
diff --git a/gcc/diagnostics/text-sink.h b/gcc/diagnostics/text-sink.h
index de7b71d..460e53e 100644
--- a/gcc/diagnostics/text-sink.h
+++ b/gcc/diagnostics/text-sink.h
@@ -44,7 +44,7 @@ public:
m_includes_seen (nullptr),
m_source_printing (source_printing
? *source_printing
- : dc.m_source_printing),
+ : dc.get_source_printing_options ()),
m_follows_reference_printer (follows_reference_printer),
m_show_nesting (false),
m_show_nesting_levels (false)
diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc
index 564513d..ebf9e61 100644
--- a/gcc/fortran/error.cc
+++ b/gcc/fortran/error.cc
@@ -573,7 +573,7 @@ gfc_diagnostic_text_starter (diagnostics::text_sink &text_output,
? gfc_diagnostic_build_locus_prefix (loc_policy, s1, colorize)
: gfc_diagnostic_build_locus_prefix (loc_policy, s1, s2, colorize);
- if (!context->m_source_printing.enabled
+ if (!context->get_source_printing_options ().enabled
|| diagnostic_location (diagnostic, 0) <= BUILTINS_LOCATION
|| diagnostic_location (diagnostic, 0) == context->m_last_location)
{
@@ -960,8 +960,9 @@ gfc_diagnostics_init (void)
diagnostics::start_span (global_dc) = gfc_diagnostic_start_span;
diagnostics::text_finalizer (global_dc) = gfc_diagnostic_text_finalizer;
global_dc->set_format_decoder (gfc_format_decoder);
- global_dc->m_source_printing.caret_chars[0] = '1';
- global_dc->m_source_printing.caret_chars[1] = '2';
+ auto &source_printing_opts = global_dc->get_source_printing_options ();
+ source_printing_opts.caret_chars[0] = '1';
+ source_printing_opts.caret_chars[1] = '2';
pp_warning_buffer = new diagnostics::buffer (*global_dc);
error_buffer = new gfc_error_buffer ();
pp_error_buffer = &(error_buffer->buffer);
@@ -975,8 +976,9 @@ gfc_diagnostics_finish (void)
defaults. */
diagnostics::text_starter (global_dc) = gfc_diagnostic_text_starter;
diagnostics::text_finalizer (global_dc) = gfc_diagnostic_text_finalizer;
- global_dc->m_source_printing.caret_chars[0] = '^';
- global_dc->m_source_printing.caret_chars[1] = '^';
+ auto &source_printing_opts = global_dc->get_source_printing_options ();
+ source_printing_opts.caret_chars[0] = '^';
+ source_printing_opts.caret_chars[1] = '^';
delete error_buffer;
error_buffer = nullptr;
pp_error_buffer = nullptr;
diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc
index 04fcc68..7df8c95 100644
--- a/gcc/libgdiagnostics.cc
+++ b/gcc/libgdiagnostics.cc
@@ -657,14 +657,15 @@ public:
m_dc.set_show_cwe (true);
m_dc.set_show_rules (true);
m_dc.m_show_column = true;
- m_dc.m_source_printing.enabled = true;
- m_dc.m_source_printing.colorize_source_p = true;
+ auto &source_printing_opts = m_dc.get_source_printing_options ();
+ source_printing_opts.enabled = true;
+ source_printing_opts.colorize_source_p = true;
/* We don't currently expose a way for clients to manipulate the
following. */
- m_dc.m_source_printing.show_labels_p = true;
- m_dc.m_source_printing.show_line_numbers_p = true;
- m_dc.m_source_printing.min_margin_width = 6;
+ source_printing_opts.show_labels_p = true;
+ source_printing_opts.show_line_numbers_p = true;
+ source_printing_opts.min_margin_width = 6;
m_dc.set_path_format (DPF_INLINE_EVENTS);
m_dc.m_client_aux_data = this;
@@ -1412,7 +1413,7 @@ diagnostic_text_sink::diagnostic_text_sink (diagnostic_manager &mgr,
FILE *dst_stream,
enum diagnostic_colorize colorize)
: sink (mgr),
- m_source_printing (mgr.get_dc ().m_source_printing)
+ m_source_printing (mgr.get_dc ().get_source_printing_options ())
{
auto inner_sink
= std::make_unique<diagnostics::text_sink> (mgr.get_dc (),
diff --git a/gcc/opts.cc b/gcc/opts.cc
index ec999be..c21e66b 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -2962,19 +2962,19 @@ common_handle_option (struct gcc_options *opts,
break;
case OPT_fdiagnostics_show_caret:
- dc->m_source_printing.enabled = value;
+ dc->get_source_printing_options ().enabled = value;
break;
case OPT_fdiagnostics_show_event_links:
- dc->m_source_printing.show_event_links_p = value;
+ dc->get_source_printing_options ().show_event_links_p = value;
break;
case OPT_fdiagnostics_show_labels:
- dc->m_source_printing.show_labels_p = value;
+ dc->get_source_printing_options ().show_labels_p = value;
break;
case OPT_fdiagnostics_show_line_numbers:
- dc->m_source_printing.show_line_numbers_p = value;
+ dc->get_source_printing_options ().show_line_numbers_p = value;
break;
case OPT_fdiagnostics_color_:
@@ -3052,7 +3052,7 @@ common_handle_option (struct gcc_options *opts,
break;
case OPT_fdiagnostics_minimum_margin_width_:
- dc->m_source_printing.min_margin_width = value;
+ dc->get_source_printing_options ().min_margin_width = value;
break;
case OPT_fdump_:
@@ -3090,7 +3090,7 @@ common_handle_option (struct gcc_options *opts,
case OPT_fmessage_length_:
pp_set_line_maximum_length (dc->get_reference_printer (), value);
- diagnostic_set_caret_max_width (dc, value);
+ dc->set_caret_max_width (value);
break;
case OPT_fopt_info:
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.cc
index 44b94da..7e34a42 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.cc
@@ -115,7 +115,7 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->m_source_printing.max_width = 80;
+ global_dc->get_source_printing_options ().max_width = 80;
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.cc
index 7edce1f..d38538d 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.cc
@@ -169,7 +169,7 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->m_source_printing.max_width = 80;
+ global_dc->get_source_printing_options ().max_width = 80;
pass_info.pass = new pass_test_inlining (g);
pass_info.reference_pass_name = "*warn_function_noreturn";
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
index 6d3f6f8..2c9ff1c 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
@@ -558,7 +558,7 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->m_source_printing.max_width = 80;
+ global_dc->get_source_printing_options ().max_width = 80;
pass_info.pass = make_pass_test_show_path (g);
pass_info.reference_pass_name = "whole-program";
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 e1fc56c..92839cd 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
@@ -181,7 +181,7 @@ test_show_locus (function *fun)
/* Hardcode the "terminal width", to verify the behavior of
very wide lines. */
- global_dc->m_source_printing.max_width = 71;
+ global_dc->get_source_printing_options ().max_width = 71;
if (0 == strcmp (fnname, "test_simple"))
{
@@ -252,7 +252,7 @@ test_show_locus (function *fun)
if (0 == strcmp (fnname, "test_very_wide_line"))
{
const int line = fnstart_line + 2;
- global_dc->m_source_printing.show_ruler_p = true;
+ global_dc->get_source_printing_options ().show_ruler_p = true;
text_range_label label0 ("label 0");
text_range_label label1 ("label 1");
rich_location richloc (line_table,
@@ -264,7 +264,7 @@ test_show_locus (function *fun)
&label1);
richloc.add_fixit_replace ("bar * foo");
warning_at (&richloc, 0, "test");
- global_dc->m_source_printing.show_ruler_p = false;
+ global_dc->get_source_printing_options ().show_ruler_p = false;
}
/* Likewise, but with a secondary location that's immediately before
@@ -272,7 +272,7 @@ test_show_locus (function *fun)
if (0 == strcmp (fnname, "test_very_wide_line_2"))
{
const int line = fnstart_line + 2;
- global_dc->m_source_printing.show_ruler_p = true;
+ global_dc->get_source_printing_options ().show_ruler_p = true;
text_range_label label0 ("label 0");
text_range_label label1 ("label 1");
rich_location richloc (line_table,
@@ -284,7 +284,7 @@ test_show_locus (function *fun)
richloc.add_range (get_loc (line, 34), SHOW_RANGE_WITHOUT_CARET,
&label1);
warning_at (&richloc, 0, "test");
- global_dc->m_source_printing.show_ruler_p = false;
+ global_dc->get_source_printing_options ().show_ruler_p = false;
}
/* Example of multiple carets. */
@@ -295,11 +295,11 @@ test_show_locus (function *fun)
location_t caret_b = get_loc (line, 11);
rich_location richloc (line_table, caret_a);
add_range (&richloc, caret_b, caret_b, SHOW_RANGE_WITH_CARET);
- global_dc->m_source_printing.caret_chars[0] = 'A';
- global_dc->m_source_printing.caret_chars[1] = 'B';
+ global_dc->get_source_printing_options ().caret_chars[0] = 'A';
+ global_dc->get_source_printing_options ().caret_chars[1] = 'B';
warning_at (&richloc, 0, "test");
- global_dc->m_source_printing.caret_chars[0] = '^';
- global_dc->m_source_printing.caret_chars[1] = '^';
+ global_dc->get_source_printing_options ().caret_chars[0] = '^';
+ global_dc->get_source_printing_options ().caret_chars[1] = '^';
}
/* Tests of rendering fixit hints. */
@@ -413,11 +413,11 @@ test_show_locus (function *fun)
location_t caret_b = get_loc (line - 1, 19);
rich_location richloc (line_table, caret_a);
richloc.add_range (caret_b, SHOW_RANGE_WITH_CARET);
- global_dc->m_source_printing.caret_chars[0] = '1';
- global_dc->m_source_printing.caret_chars[1] = '2';
+ global_dc->get_source_printing_options ().caret_chars[0] = '1';
+ global_dc->get_source_printing_options ().caret_chars[1] = '2';
warning_at (&richloc, 0, "test");
- global_dc->m_source_printing.caret_chars[0] = '^';
- global_dc->m_source_printing.caret_chars[1] = '^';
+ global_dc->get_source_printing_options ().caret_chars[0] = '^';
+ global_dc->get_source_printing_options ().caret_chars[1] = '^';
}
/* Example of using the "%q+D" format code, which as well as printing
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc
index 1b5fad2..b64d60f 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc
@@ -208,7 +208,7 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->m_source_printing.max_width = 80;
+ global_dc->get_source_printing_options ().max_width = 80;
pass_info.pass = new pass_test_string_literals (g);
pass_info.reference_pass_name = "ssa";
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc
index fbdb2f8..bbd0faa 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc
@@ -89,7 +89,7 @@ plugin_init (struct plugin_name_args *plugin_info,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->m_source_printing.max_width = 130;
+ global_dc->get_source_printing_options ().max_width = 130;
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
diff --git a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
index ea37921..67722d4 100644
--- a/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/expensive_selftests_plugin.cc
@@ -48,7 +48,7 @@ test_richloc (rich_location *richloc)
{
/* Run the diagnostic and fix-it printing code. */
diagnostics::selftest::test_context dc;
- diagnostic_show_locus (&dc, dc.m_source_printing,
+ diagnostic_show_locus (&dc, dc.get_source_printing_options (),
richloc, diagnostics::kind::error,
dc.get_reference_printer ());
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 75f807b..70dbb3e 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -1070,13 +1070,14 @@ general_init (const char *argv0, bool init_signals, unique_argv original_argv)
global_dc->set_original_argv (std::move (original_argv));
- global_dc->m_source_printing.enabled
+ auto &source_printing_opts = global_dc->get_source_printing_options ();
+ source_printing_opts.enabled
= global_options_init.x_flag_diagnostics_show_caret;
- global_dc->m_source_printing.show_event_links_p
+ source_printing_opts.show_event_links_p
= global_options_init.x_flag_diagnostics_show_event_links;
- global_dc->m_source_printing.show_labels_p
+ source_printing_opts.show_labels_p
= global_options_init.x_flag_diagnostics_show_labels;
- global_dc->m_source_printing.show_line_numbers_p
+ source_printing_opts.show_line_numbers_p
= global_options_init.x_flag_diagnostics_show_line_numbers;
global_dc->set_show_cwe (global_options_init.x_flag_diagnostics_show_cwe);
global_dc->set_show_rules (global_options_init.x_flag_diagnostics_show_rules);
@@ -1087,7 +1088,7 @@ general_init (const char *argv0, bool init_signals, unique_argv original_argv)
(global_options_init.x_flag_diagnostics_show_path_depths);
global_dc->set_show_option_requested
(global_options_init.x_flag_diagnostics_show_option);
- global_dc->m_source_printing.min_margin_width
+ source_printing_opts.min_margin_width
= global_options_init.x_diagnostics_minimum_margin_width;
global_dc->m_show_column
= global_options_init.x_flag_show_column;