* [pushed] analyzer: fix clang warnings [PR112317]
@ 2023-11-02 12:48 David Malcolm
0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2023-11-02 12:48 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
No functional change intended.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r14-5080-gc71028c979d55f.
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".
---
gcc/analyzer/access-diagram.cc | 9 +++------
gcc/analyzer/region-model.cc | 21 +++++----------------
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 c7d190e3188..fb8c0282e75 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 9479bcf380c..dc834406520 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 8bfb06880ff..4d8480df141 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);
--
2.26.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-02 12:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 12:48 [pushed] analyzer: fix clang warnings [PR112317] David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).