]> gcc.gnu.org Git - gcc.git/commitdiff
analyzer: fix clang warnings [PR112317]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 2 Nov 2023 12:39:51 +0000 (08:39 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 2 Nov 2023 12:39:51 +0000 (08:39 -0400)
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>
gcc/analyzer/access-diagram.cc
gcc/analyzer/region-model.cc
gcc/analyzer/region-model.h

index c7d190e3188ef1dbc3dc97c119baa4f14870d9a8..fb8c0282e751e2aeef6c7d82a90c000fee176374 100644 (file)
@@ -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))
index 9479bcf380cd3e11b447a4b1a66dbe115e916787..dc8344065202708f87de4dcf0b5bac1f3b9bf378 100644 (file)
@@ -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;
       }
index 8bfb06880ff4a8e5f35703207f10af3344e34c9b..4d8480df141e0a70189bab00a331e7c4ab5ba17d 100644 (file)
@@ -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);
This page took 0.070783 seconds and 5 git commands to generate.