aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.cc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-10-02 12:16:55 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2023-10-02 12:16:55 -0400
commitc5c565eff6277ac176d6c5c94f55859d0eb28938 (patch)
treeaebf4d02a7be6e413e14fa16afbbfd5a9f00742c /gcc/diagnostic.cc
parentc64693fb885f21fafa01d67c5d85e11942770a7c (diff)
downloadgcc-c5c565eff6277ac176d6c5c94f55859d0eb28938.zip
gcc-c5c565eff6277ac176d6c5c94f55859d0eb28938.tar.gz
gcc-c5c565eff6277ac176d6c5c94f55859d0eb28938.tar.bz2
diagnostics: group together source printing fields of diagnostic_context
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>
Diffstat (limited to 'gcc/diagnostic.cc')
-rw-r--r--gcc/diagnostic.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 28ab74f..b4bbd60 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -147,7 +147,7 @@ diagnostic_set_caret_max_width (diagnostic_context *context, int value)
if (value <= 0)
value = INT_MAX;
- context->caret_max_width = value;
+ context->m_source_printing.max_width = value;
}
/* Default implementation of final_cb. */
@@ -189,10 +189,10 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
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;
@@ -220,11 +220,11 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
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"))