diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-11-02 08:39:51 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-11-02 08:39:51 -0400 |
commit | c71028c979d55f98b7727f9387bbe2f4ffe6de13 (patch) | |
tree | d90e7229dafc3d8e827a0f8afadcbac4305bb826 | |
parent | 81a81abec5c28f2c08f986f1f17ac66e555cbd4b (diff) | |
download | gcc-c71028c979d55f98b7727f9387bbe2f4ffe6de13.zip gcc-c71028c979d55f98b7727f9387bbe2f4ffe6de13.tar.gz gcc-c71028c979d55f98b7727f9387bbe2f4ffe6de13.tar.bz2 |
analyzer: fix clang warnings [PR112317]
No functional change intended.
gcc/analyzer/ChangeLog:
PR analyzer/112317
* access-diagram.cc (class x_aligned_x_ruler_widget): Eliminate
unused field "m_col_widths".
(access_diagram_impl::add_valid_vs_invalid_ruler): Update for
above change.
* region-model.cc
(check_one_function_attr_null_terminated_string_arg): Remove
unused variables "cd_unchecked", "strlen_sval", and
"limited_sval".
* region-model.h (region_model_context_decorator::warn): Add
missing "override".
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
-rw-r--r-- | gcc/analyzer/access-diagram.cc | 9 | ||||
-rw-r--r-- | gcc/analyzer/region-model.cc | 21 | ||||
-rw-r--r-- | gcc/analyzer/region-model.h | 2 |
3 files changed, 9 insertions, 23 deletions
diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index c7d190e..fb8c028 100644 --- a/gcc/analyzer/access-diagram.cc +++ b/gcc/analyzer/access-diagram.cc @@ -919,11 +919,9 @@ class x_aligned_x_ruler_widget : public leaf_widget { public: x_aligned_x_ruler_widget (const access_diagram_impl &dia_impl, - const theme &theme, - table_dimension_sizes &col_widths) + const theme &theme) : m_dia_impl (dia_impl), - m_theme (theme), - m_col_widths (col_widths) + m_theme (theme) { } @@ -973,7 +971,6 @@ private: const access_diagram_impl &m_dia_impl; const theme &m_theme; - table_dimension_sizes &m_col_widths; std::vector<label> m_labels; }; @@ -2361,7 +2358,7 @@ private: LOG_SCOPE (m_logger); x_aligned_x_ruler_widget *w - = new x_aligned_x_ruler_widget (*this, m_theme, *m_col_widths); + = new x_aligned_x_ruler_widget (*this, m_theme); access_range invalid_before_bits; if (m_op.maybe_get_invalid_before_bits (&invalid_before_bits)) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 9479bcf..dc83440 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -1877,23 +1877,13 @@ check_one_function_attr_null_terminated_string_arg (const gcall *call, || access->mode == access_read_write) && access->sizarg != UINT_MAX) { - /* First, check for a null-terminated string *without* - emitting warnings (via a null context), to get an - svalue for the strlen of the buffer (possibly - nullptr if there would be an issue). */ - call_details cd_unchecked (call, this, nullptr); - const svalue *strlen_sval - = check_for_null_terminated_string_arg (cd_unchecked, - arg_idx); - - /* Get svalue for the size limit argument. */ call_details cd_checked (call, this, ctxt); const svalue *limit_sval = cd_checked.get_arg_svalue (access->sizarg); const svalue *ptr_sval = cd_checked.get_arg_svalue (arg_idx); /* Try reading all of the bytes expressed by the size param, - but without checking (via a null context). */ + but without emitting warnings (via a null context). */ const svalue *limited_sval = read_bytes (deref_rvalue (ptr_sval, NULL_TREE, nullptr), NULL_TREE, @@ -1912,11 +1902,10 @@ check_one_function_attr_null_terminated_string_arg (const gcall *call, { /* Reading up to the truncation limit seems OK; repeat the read, but with checking enabled. */ - const svalue *limited_sval - = read_bytes (deref_rvalue (ptr_sval, NULL_TREE, ctxt), - NULL_TREE, - limit_sval, - ctxt); + read_bytes (deref_rvalue (ptr_sval, NULL_TREE, ctxt), + NULL_TREE, + limit_sval, + ctxt); } return; } diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index 8bfb068..4d8480d 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -890,7 +890,7 @@ class region_model_context_decorator : public region_model_context { public: bool warn (std::unique_ptr<pending_diagnostic> d, - const stmt_finder *custom_finder) + const stmt_finder *custom_finder) override { if (m_inner) return m_inner->warn (std::move (d), custom_finder); |