struct diagnostic_context has > 60 fields.
Try to tame some of the complexity by grouping together the 8
source-printing fields into a struct, the "m_source_printing" field.
No functional change intended.
gcc/ada/ChangeLog:
* gcc-interface/misc.cc (gnat_post_options): Update for renaming
of diagnostic_context's show_caret to m_source_printing.enabled.
gcc/analyzer/ChangeLog:
* program-point.cc: Update for grouping of source printing fields
within diagnostic_context.
gcc/c-family/ChangeLog:
* c-common.cc (maybe_add_include_fixit): Update for renaming of
diagnostic_context's show_caret to m_source_printing.enabled.
* c-opts.cc (c_common_init_options): Update for renaming of
diagnostic_context's colorize_source_p to
m_source_printing.colorize_source_p.
gcc/ChangeLog:
* diagnostic-show-locus.cc: Update for reorganization of
source-printing fields of diagnostic_context.
* diagnostic.cc (diagnostic_set_caret_max_width): Likewise.
(diagnostic_initialize): Likewise.
* diagnostic.h (diagnostic_context::show_caret): Move to...
(diagnostic_context::m_source_printing::enabled): ...here.
(diagnostic_context::caret_max_width): Move to...
(diagnostic_context::m_source_printing::max_width): ...here.
(diagnostic_context::caret_chars): Move to...
(diagnostic_context::m_source_printing::caret_chars): ...here.
(diagnostic_context::colorize_source_p): Move to...
(diagnostic_context::m_source_printing::colorize_source_p): ...here.
(diagnostic_context::show_labels_p): Move to...
(diagnostic_context::m_source_printing::show_labels_p): ...here.
(diagnostic_context::show_line_numbers_p): Move to...
(diagnostic_context::m_source_printing::show_line_numbers_p): ...here.
(diagnostic_context::min_margin_width): Move to...
(diagnostic_context::m_source_printing::min_margin_width): ...here.
(diagnostic_context::show_ruler_p): Move to...
(diagnostic_context::m_source_printing::show_ruler_p): ...here.
(diagnostic_same_line): Update for above changes.
* opts.cc (common_handle_option): Update for reorganization of
source-printing fields of diagnostic_context.
* selftest-diagnostic.cc
(test_diagnostic_context::test_diagnostic_context): Likewise.
* toplev.cc (general_init): Likewise.
* tree-diagnostic-path.cc (struct event_range): Likewise.
gcc/fortran/ChangeLog:
* error.cc (gfc_diagnostic_starter): Update for reorganization of
source-printing fields of diagnostic_context.
(gfc_diagnostics_init): Likewise.
(gfc_diagnostics_finish): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_show_trees.c: Update for
reorganization of source-printing fields of diagnostic_context.
* gcc.dg/plugin/diagnostic_plugin_test_inlining.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_string_literals.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c:
Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
/* No caret by default for Ada. */
if (!OPTION_SET_P (flag_diagnostics_show_caret))
- global_dc->show_caret = false;
+ global_dc->m_source_printing.enabled = false;
/* Copy global settings to local versions. */
gnat_encodings = global_options.x_gnat_encodings;
debug_diagnostic_context ()
{
diagnostic_initialize (this, 0);
- show_line_numbers_p = true;
- show_caret = true;
+ m_source_printing.show_line_numbers_p = true;
+ m_source_printing.enabled = true;
}
~debug_diagnostic_context ()
{
richloc->add_fixit_insert_before (include_insert_loc, text);
free (text);
- if (override_location && global_dc->show_caret)
+ if (override_location && global_dc->m_source_printing.enabled)
{
/* Replace the primary location with that of the insertion point for the
fix-it hint.
if (c_dialect_cxx ())
set_std_cxx17 (/*ISO*/false);
- global_dc->colorize_source_p = true;
+ global_dc->m_source_printing.colorize_source_p = true;
}
/* Handle switch SCODE with argument ARG. VALUE is true, unless no-
m_exploc (richloc->get_expanded_location (0), m_policy,
LOCATION_ASPECT_CARET),
m_colorizer (context, diagnostic_kind),
- m_colorize_source_p (context->colorize_source_p),
- m_show_labels_p (context->show_labels_p),
- m_show_line_numbers_p (context->show_line_numbers_p),
+ m_colorize_source_p (context->m_source_printing.colorize_source_p),
+ m_show_labels_p (context->m_source_printing.show_labels_p),
+ m_show_line_numbers_p (context->m_source_printing.show_line_numbers_p),
m_diagnostic_path_p (diagnostic_kind == DK_DIAGNOSTIC_PATH),
m_layout_ranges (richloc->get_num_locations ()),
m_fixit_hints (richloc->get_num_fixit_hints ()),
calculate_linenum_width ();
calculate_x_offset_display ();
- if (context->show_ruler_p)
- show_ruler (m_x_offset_display + m_context->caret_max_width);
+ if (context->m_source_printing.show_ruler_p)
+ show_ruler (m_x_offset_display + m_context->m_source_printing.max_width);
}
m_linenum_width = MAX (m_linenum_width, 3);
/* If there's a minimum margin width, apply it (subtracting 1 for the space
after the line number. */
- m_linenum_width = MAX (m_linenum_width, m_context->min_margin_width - 1);
+ m_linenum_width = MAX (m_linenum_width,
+ m_context->m_source_printing.min_margin_width - 1);
}
/* Calculate m_x_offset_display, which improves readability in case the source
{
m_x_offset_display = 0;
- const int max_width = m_context->caret_max_width;
+ const int max_width = m_context->m_source_printing.max_width;
if (!max_width)
{
/* Nothing to do, the width is not capped. */
/* Draw the caret. */
char caret_char;
if (state.range_idx < rich_location::STATICALLY_ALLOCATED_RANGES)
- caret_char = m_context->caret_chars[state.range_idx];
+ caret_char
+ = m_context->m_source_printing.caret_chars[state.range_idx];
else
caret_char = '^';
pp_character (m_pp, caret_char);
{
location_t loc = richloc->get_loc ();
/* Do nothing if source-printing has been disabled. */
- if (!context->show_caret)
+ if (!context->m_source_printing.enabled)
return;
/* Don't attempt to print source for UNKNOWN_LOCATION and for builtins. */
line_span_idx++)
{
const line_span *line_span = layout.get_line_span (line_span_idx);
- if (context->show_line_numbers_p)
+ if (context->m_source_printing.show_line_numbers_p)
{
/* With line numbers, we should show whenever the line-numbering
"jumps". */
int left_margin = test_left_margin)
{
test_diagnostic_context dc;
- dc.caret_max_width = max_width;
+ dc.m_source_printing.max_width = max_width;
/* diagnostic_context::min_margin_width sets the minimum space reserved for
the line number plus one space after. */
- dc.min_margin_width = left_margin - test_linenum_sep + 1;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.min_margin_width = left_margin - test_linenum_sep + 1;
+ dc.m_source_printing.show_line_numbers_p = true;
rich_location richloc (line_table,
linemap_position_for_column (line_table,
caret_byte_col));
/* Test that the source line is offset as expected when printed. */
{
test_diagnostic_context dc;
- dc.caret_max_width = small_width - 6;
- dc.min_margin_width = test_left_margin - test_linenum_sep + 1;
- dc.show_line_numbers_p = true;
- dc.show_ruler_p = true;
+ dc.m_source_printing.max_width = small_width - 6;
+ dc.m_source_printing.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;
rich_location richloc (line_table,
linemap_position_for_column (line_table,
emoji_col));
it with a padding space in this case. */
{
test_diagnostic_context dc;
- dc.caret_max_width = small_width - 5;
- dc.min_margin_width = test_left_margin - test_linenum_sep + 1;
- dc.show_line_numbers_p = true;
- dc.show_ruler_p = true;
+ dc.m_source_printing.max_width = small_width - 5;
+ dc.m_source_printing.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;
rich_location richloc (line_table,
linemap_position_for_column (line_table,
emoji_col + 2));
test_diagnostic_context dc;
dc.tabstop = tabstop;
static const int small_width = 24;
- dc.caret_max_width = small_width - 4;
- dc.min_margin_width = test_left_margin - test_linenum_sep + 1;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.max_width = small_width - 4;
+ dc.m_source_printing.min_margin_width
+ = test_left_margin - test_linenum_sep + 1;
+ dc.m_source_printing.show_line_numbers_p = true;
layout test_layout (&dc, &richloc, DK_ERROR);
test_layout.print_line (1);
= make_location (linemap_position_for_column (line_table, 2),
linemap_position_for_column (line_table, 1),
linemap_position_for_column (line_table, 3));
- dc.caret_chars[0] = 'A';
+ dc.m_source_printing.caret_chars[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.caret_chars[1] = 'B';
+ dc.m_source_printing.caret_chars[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.caret_chars[2] = 'C';
+ dc.m_source_printing.caret_chars[2] = 'C';
rich_location richloc (line_table, foo);
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
/* Normal, with ruler. */
{
test_diagnostic_context dc;
- dc.show_ruler_p = true;
- dc.caret_max_width = 104;
+ dc.m_source_printing.show_ruler_p = true;
+ dc.m_source_printing.max_width = 104;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" 0 0 0 0 0 0 0 0 0 1 \n"
" 1 2 3 4 5 6 7 8 9 0 \n"
/* Test of adding a prefix, with ruler. */
{
test_diagnostic_context dc;
- dc.show_ruler_p = true;
- dc.caret_max_width = 50;
+ dc.m_source_printing.show_ruler_p = true;
+ dc.m_source_printing.max_width = 50;
pp_prefixing_rule (dc.printer) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.printer, xstrdup ("TEST PREFIX:"));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* Test of adding a prefix, with ruler and line numbers. */
{
test_diagnostic_context dc;
- dc.show_ruler_p = true;
- dc.caret_max_width = 50;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.show_ruler_p = true;
+ dc.m_source_printing.max_width = 50;
+ dc.m_source_printing.show_line_numbers_p = true;
pp_prefixing_rule (dc.printer) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.printer, xstrdup ("TEST PREFIX:"));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* Verify that we can disable label-printing. */
{
test_diagnostic_context dc;
- dc.show_labels_p = false;
+ dc.m_source_printing.show_labels_p = false;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n",
= make_location (linemap_position_for_column (line_table, 7),
linemap_position_for_column (line_table, 1),
linemap_position_for_column (line_table, 8));
- dc.caret_chars[0] = 'A';
+ dc.m_source_printing.caret_chars[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.caret_chars[1] = 'B';
+ dc.m_source_printing.caret_chars[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.caret_chars[2] = 'C';
+ dc.m_source_printing.caret_chars[2] = 'C';
rich_location richloc (line_table, foo);
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
richloc.add_range (field, SHOW_RANGE_WITH_CARET);
test_one_liner_colorized_utf8 ()
{
test_diagnostic_context dc;
- dc.colorize_source_p = true;
+ dc.m_source_printing.colorize_source_p = 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);
richloc.add_fixit_insert_before (y, ".");
richloc.add_fixit_replace (colon, "=");
test_diagnostic_context dc;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" 3 | y\n"
" | .\n"
/* With line numbers. */
{
test_diagnostic_context dc;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" 2 | x = a;\n"
" +++ |+ break;\n"
consolidated, since it makes little sense to skip line 2. */
{
test_diagnostic_context dc;
- dc.show_line_numbers_p = true;
+ dc.m_source_printing.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" +++ |+#include <stdio.h>\n"
" 1 | test (int ch)\n"
location_t loc = make_location (caret, start, finish);
test_diagnostic_context dc;
- dc.show_line_numbers_p = true;
- dc.min_margin_width = 0;
+ dc.m_source_printing.show_line_numbers_p = true;
+ dc.m_source_printing.min_margin_width = 0;
gcc_rich_location richloc (loc);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
ASSERT_STREQ (" 9 | this is line 9\n"
if (value <= 0)
value = INT_MAX;
- context->caret_max_width = value;
+ context->m_source_printing.max_width = value;
}
/* Default implementation of final_cb. */
context->classify_diagnostic = XNEWVEC (diagnostic_t, n_opts);
for (i = 0; i < n_opts; i++)
context->classify_diagnostic[i] = DK_UNSPECIFIED;
- context->show_caret = false;
+ context->m_source_printing.enabled = false;
diagnostic_set_caret_max_width (context, pp_line_cutoff (context->printer));
for (i = 0; i < rich_location::STATICALLY_ALLOCATED_RANGES; i++)
- context->caret_chars[i] = '^';
+ context->m_source_printing.caret_chars[i] = '^';
context->show_cwe = false;
context->show_rules = false;
context->path_format = DPF_NONE;
context->x_data = NULL;
context->lock = 0;
context->inhibit_notes_p = false;
- context->colorize_source_p = false;
- context->show_labels_p = false;
- context->show_line_numbers_p = false;
- context->min_margin_width = 0;
- context->show_ruler_p = false;
+ context->m_source_printing.colorize_source_p = false;
+ context->m_source_printing.show_labels_p = false;
+ context->m_source_printing.show_line_numbers_p = false;
+ context->m_source_printing.min_margin_width = 0;
+ context->m_source_printing.show_ruler_p = false;
context->report_bug = false;
if (const char *var = getenv ("GCC_EXTRA_DIAGNOSTIC_OUTPUT"))
int *push_list;
int n_push;
- /* True if we should print the source line with a caret indicating
- the location. */
- bool show_caret;
-
- /* Maximum width of the source line printed. */
- int caret_max_width;
-
- /* Character used for caret diagnostics. */
- char caret_chars[rich_location::STATICALLY_ALLOCATED_RANGES];
-
/* True if we should print any CWE identifiers associated with
diagnostics. */
bool show_cwe;
bool inhibit_notes_p;
- /* When printing source code, should the characters at carets and ranges
- be colorized? (assuming colorization is on at all).
- This should be true for frontends that generate range information
- (so that the ranges of code are colorized),
- and false for frontends that merely specify points within the
- source code (to avoid e.g. colorizing just the first character in
- a token, which would look strange). */
- bool colorize_source_p;
+ /* Fields relating to printing the user's source code (potentially with
+ a margin, underlining, labels, etc). */
+ struct {
+
+ /* True if we should print the source line with a caret indicating
+ the location.
+ Corresponds to -fdiagnostics-show-caret. */
+ bool enabled;
+
+ /* Maximum width of the source line printed. */
+ int max_width;
+
+ /* Character used at the caret when printing source locations. */
+ char caret_chars[rich_location::STATICALLY_ALLOCATED_RANGES];
+
+ /* When printing source code, should the characters at carets and ranges
+ be colorized? (assuming colorization is on at all).
+ This should be true for frontends that generate range information
+ (so that the ranges of code are colorized),
+ and false for frontends that merely specify points within the
+ source code (to avoid e.g. colorizing just the first character in
+ a token, which would look strange). */
+ bool colorize_source_p;
+
+ /* When printing source code, should labelled ranges be printed?
+ Corresponds to -fdiagnostics-show-labels. */
+ bool show_labels_p;
- /* When printing source code, should labelled ranges be printed? */
- bool show_labels_p;
+ /* When printing source code, should there be a left-hand margin
+ showing line numbers?
+ Corresponds to -fdiagnostics-show-line-numbers. */
+ bool show_line_numbers_p;
- /* When printing source code, should there be a left-hand margin
- showing line numbers? */
- bool show_line_numbers_p;
+ /* If printing source code, what should the minimum width of the margin
+ be? Line numbers will be right-aligned, and padded to this width.
+ Corresponds to -fdiagnostics-minimum-margin-width=VALUE. */
+ int min_margin_width;
- /* If printing source code, what should the minimum width of the margin
- be? Line numbers will be right-aligned, and padded to this width. */
- int min_margin_width;
+ /* Usable by plugins; if true, print a debugging ruler above the
+ source output. */
+ bool show_ruler_p;
- /* Usable by plugins; if true, print a debugging ruler above the
- source output. */
- bool show_ruler_p;
+ } m_source_printing;
/* True if -freport-bug option is used. */
bool report_bug;
diagnostic_same_line (const diagnostic_context *context,
expanded_location s1, expanded_location s2)
{
- return s2.column && s1.line == s2.line
- && context->caret_max_width - CARET_LINE_MARGIN > abs (s1.column - s2.column);
+ return (s2.column && s1.line == s2.line
+ && (context->m_source_printing.max_width - CARET_LINE_MARGIN
+ > abs (s1.column - s2.column)));
}
extern const char *diagnostic_get_color_for_kind (diagnostic_t kind);
? gfc_diagnostic_build_locus_prefix (context, s1)
: gfc_diagnostic_build_locus_prefix (context, s1, s2);
- if (!context->show_caret
+ if (!context->m_source_printing.enabled
|| diagnostic_location (diagnostic, 0) <= BUILTINS_LOCATION
|| diagnostic_location (diagnostic, 0) == context->last_location)
{
global_dc->start_span = gfc_diagnostic_start_span;
diagnostic_finalizer (global_dc) = gfc_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = gfc_format_decoder;
- global_dc->caret_chars[0] = '1';
- global_dc->caret_chars[1] = '2';
+ global_dc->m_source_printing.caret_chars[0] = '1';
+ global_dc->m_source_printing.caret_chars[1] = '2';
pp_warning_buffer = new (XNEW (output_buffer)) output_buffer ();
pp_warning_buffer->flush_p = false;
/* pp_error_buffer is statically allocated. This simplifies memory
defaults. */
diagnostic_starter (global_dc) = gfc_diagnostic_starter;
diagnostic_finalizer (global_dc) = gfc_diagnostic_finalizer;
- global_dc->caret_chars[0] = '^';
- global_dc->caret_chars[1] = '^';
+ global_dc->m_source_printing.caret_chars[0] = '^';
+ global_dc->m_source_printing.caret_chars[1] = '^';
}
break;
case OPT_fdiagnostics_show_caret:
- dc->show_caret = value;
+ dc->m_source_printing.enabled = value;
break;
case OPT_fdiagnostics_show_labels:
- dc->show_labels_p = value;
+ dc->m_source_printing.show_labels_p = value;
break;
case OPT_fdiagnostics_show_line_numbers:
- dc->show_line_numbers_p = value;
+ dc->m_source_printing.show_line_numbers_p = value;
break;
case OPT_fdiagnostics_color_:
break;
case OPT_fdiagnostics_minimum_margin_width_:
- dc->min_margin_width = value;
+ dc->m_source_printing.min_margin_width = value;
break;
case OPT_fdump_:
test_diagnostic_context::test_diagnostic_context ()
{
diagnostic_initialize (this, 0);
- show_caret = true;
- show_labels_p = true;
+ m_source_printing.enabled = true;
+ m_source_printing.show_labels_p = true;
show_column = true;
start_span = start_span_cb;
- min_margin_width = 6;
- caret_max_width = 80;
+ m_source_printing.min_margin_width = 6;
+ m_source_printing.max_width = 80;
}
test_diagnostic_context::~test_diagnostic_context ()
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->caret_max_width = 80;
+ global_dc->m_source_printing.max_width = 80;
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->caret_max_width = 80;
+ global_dc->m_source_printing.max_width = 80;
pass_info.pass = new pass_test_inlining (g);
pass_info.reference_pass_name = "*warn_function_noreturn";
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->caret_max_width = 80;
+ global_dc->m_source_printing.max_width = 80;
pass_info.pass = make_pass_test_show_path (g);
pass_info.reference_pass_name = "whole-program";
/* Hardcode the "terminal width", to verify the behavior of
very wide lines. */
- global_dc->caret_max_width = 71;
+ global_dc->m_source_printing.max_width = 71;
if (0 == strcmp (fnname, "test_simple"))
{
if (0 == strcmp (fnname, "test_very_wide_line"))
{
const int line = fnstart_line + 2;
- global_dc->show_ruler_p = true;
+ global_dc->m_source_printing.show_ruler_p = true;
text_range_label label0 ("label 0");
text_range_label label1 ("label 1");
rich_location richloc (line_table,
&label1);
richloc.add_fixit_replace ("bar * foo");
warning_at (&richloc, 0, "test");
- global_dc->show_ruler_p = false;
+ global_dc->m_source_printing.show_ruler_p = false;
}
/* Likewise, but with a secondary location that's immediately before
if (0 == strcmp (fnname, "test_very_wide_line_2"))
{
const int line = fnstart_line + 2;
- global_dc->show_ruler_p = true;
+ global_dc->m_source_printing.show_ruler_p = true;
text_range_label label0 ("label 0");
text_range_label label1 ("label 1");
rich_location richloc (line_table,
richloc.add_range (get_loc (line, 34), SHOW_RANGE_WITHOUT_CARET,
&label1);
warning_at (&richloc, 0, "test");
- global_dc->show_ruler_p = false;
+ global_dc->m_source_printing.show_ruler_p = false;
}
/* Example of multiple carets. */
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->caret_chars[0] = 'A';
- global_dc->caret_chars[1] = 'B';
+ global_dc->m_source_printing.caret_chars[0] = 'A';
+ global_dc->m_source_printing.caret_chars[1] = 'B';
warning_at (&richloc, 0, "test");
- global_dc->caret_chars[0] = '^';
- global_dc->caret_chars[1] = '^';
+ global_dc->m_source_printing.caret_chars[0] = '^';
+ global_dc->m_source_printing.caret_chars[1] = '^';
}
/* Tests of rendering fixit hints. */
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->caret_chars[0] = '1';
- global_dc->caret_chars[1] = '2';
+ global_dc->m_source_printing.caret_chars[0] = '1';
+ global_dc->m_source_printing.caret_chars[1] = '2';
warning_at (&richloc, 0, "test");
- global_dc->caret_chars[0] = '^';
- global_dc->caret_chars[1] = '^';
+ global_dc->m_source_printing.caret_chars[0] = '^';
+ global_dc->m_source_printing.caret_chars[1] = '^';
}
/* Example of using the "%q+D" format code, which as well as printing
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->caret_max_width = 80;
+ global_dc->m_source_printing.max_width = 80;
pass_info.pass = new pass_test_string_literals (g);
pass_info.reference_pass_name = "ssa";
if (!plugin_default_version_check (version, &gcc_version))
return 1;
- global_dc->caret_max_width = 130;
+ global_dc->m_source_printing.max_width = 130;
register_callback (plugin_name,
PLUGIN_PRE_GENERICIZE,
override it later. */
tree_diagnostics_defaults (global_dc);
- global_dc->show_caret
+ global_dc->m_source_printing.enabled
= global_options_init.x_flag_diagnostics_show_caret;
- global_dc->show_labels_p
+ global_dc->m_source_printing.show_labels_p
= global_options_init.x_flag_diagnostics_show_labels;
- global_dc->show_line_numbers_p
+ global_dc->m_source_printing.show_line_numbers_p
= global_options_init.x_flag_diagnostics_show_line_numbers;
global_dc->show_cwe
= global_options_init.x_flag_diagnostics_show_cwe;
= global_options_init.x_flag_diagnostics_show_path_depths;
global_dc->show_option_requested
= global_options_init.x_flag_diagnostics_show_option;
- global_dc->min_margin_width
+ global_dc->m_source_printing.min_margin_width
= global_options_init.x_diagnostics_minimum_margin_width;
global_dc->show_column
= global_options_init.x_flag_show_column;
/* 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->show_caret)
+ if (dc->m_source_printing.enabled)
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point