aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-08-08 16:55:43 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-08-08 16:55:43 -0400
commit5edb251951a3a250b54a22fbd24c4f65f19f76fb (patch)
tree9095b84c41f1ebd60b278ab7123dd8cc93ef676b /gcc/c-family
parent435e09e05c3750cad153c3c6e83134803c22c7f6 (diff)
downloadgcc-5edb251951a3a250b54a22fbd24c4f65f19f76fb.zip
gcc-5edb251951a3a250b54a22fbd24c4f65f19f76fb.tar.gz
gcc-5edb251951a3a250b54a22fbd24c4f65f19f76fb.tar.bz2
diagnostics: introduce struct column_options
Consolidate 3 fields in diagnostics::context and diagnostics::column_policy into a new struct diagnostics::column_options. No functional change intended; reduces the number of public fields in diagnostics::context. gcc/c-family/ChangeLog: * c-indentation.cc (should_warn_for_misleading_indentation): Update for moving diagnostics::context::m_tabstop into diagnostics::column_options. * c-opts.cc (c_common_post_options): Likewise. gcc/ChangeLog: * diagnostics/column-options.h: New file, adding struct diagnostics::column_options, taken from fields in diagnostics::context and diagnostics::column_policy. * diagnostics/context.cc (context::initialize): Update for moving fields of diagnostics::context into diagnostics::column_options. (column_policy::column_policy): Likewise. (column_policy::converted_column): Move implementation to... (column_options::convert_column): ...this new function. (context::report_diagnostic): Update for moving fields of diagnostics::context into diagnostics::column_options. (assert_location_text): Likewise. * diagnostics/context.h: Include "diagnostics/column-options.h". (class column_policy): Replace fields m_column_unit, m_column_origin, and m_tabstop with m_column_options. (context::get_column_options): New accessors. (context::m_column_unit): Move to struct column_options and replace with m_column_options. (context::m_column_origin): Likewise. (context::m_tabstop): Likewise. * diagnostics/sarif-sink.cc (sarif_builder::sarif_builder): Update for moving fields of diagnostics::context into diagnostics::column_options. * diagnostics/source-printing.cc: Likewise. * opts.cc (common_handle_option): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/c-indentation.cc2
-rw-r--r--gcc/c-family/c-opts.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c-family/c-indentation.cc b/gcc/c-family/c-indentation.cc
index bb214fc..d378464 100644
--- a/gcc/c-family/c-indentation.cc
+++ b/gcc/c-family/c-indentation.cc
@@ -330,7 +330,7 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
if (guard_loc == body_loc || body_loc == next_stmt_loc)
return false;
- const unsigned int tab_width = global_dc->m_tabstop;
+ const unsigned int tab_width = global_dc->get_column_options ().m_tabstop;
/* They must be in the same file. */
if (next_stmt_exploc.file != body_exploc.file)
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 3fb12b9..0ec30e8 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -1200,7 +1200,7 @@ c_common_post_options (const char **pfilename)
flag_char8_t = (cxx_dialect >= cxx20) || flag_isoc23;
cpp_opts->unsigned_utf8char = flag_char8_t ? 1 : cpp_opts->unsigned_char;
- cpp_opts->cpp_tabstop = global_dc->m_tabstop;
+ cpp_opts->cpp_tabstop = global_dc->get_column_options ().m_tabstop;
if (flag_extern_tls_init)
{