https://gcc.gnu.org/g:405fee9e1faf20f05b62e810ec1d6528100de067

commit r16-290-g405fee9e1faf20f05b62e810ec1d6528100de067
Author: Marc Poulhiès <d...@kataplop.net>
Date:   Tue Apr 29 19:53:42 2025 +0200

    analyzer: fix for older version of GCC
    
    Having both an enum and a variable with the same name triggers an error with
    gcc 5.
    
      exploded-graph.h:351:29: error: ‘status’ is not a class, namespace, or 
enumeration
    
    gcc/analyzer/ChangeLog:
            * exploded-graph.h (set_status): Rename parameter.
            * constraint-manager.cc (bound::ensure_closed): Likewise.
            (range::add_bound): Likewise.
    
    Signed-off-by: Marc Poulhiès <d...@kataplop.net>
    Reviewed-by: David Malcolm <dmalc...@redhat.com>
    Signed-off-by: Marc Poulhiès <d...@kataplop.net>

Diff:
---
 gcc/analyzer/constraint-manager.cc | 10 +++++-----
 gcc/analyzer/exploded-graph.h      |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/analyzer/constraint-manager.cc 
b/gcc/analyzer/constraint-manager.cc
index a3e682c49389..869e437d7c51 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -104,7 +104,7 @@ minus_one (tree cst)
    closed one.  */
 
 void
-bound::ensure_closed (enum bound_kind bound_kind)
+bound::ensure_closed (enum bound_kind bnd_kind)
 {
   if (!m_closed)
     {
@@ -113,7 +113,7 @@ bound::ensure_closed (enum bound_kind bound_kind)
         and convert x < 5 into x <= 4.  */
       gcc_assert (CONSTANT_CLASS_P (m_constant));
       gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (m_constant)));
-      m_constant = fold_build2 (bound_kind == bound_kind::upper ? MINUS_EXPR : 
PLUS_EXPR,
+      m_constant = fold_build2 (bnd_kind == bound_kind::upper ? MINUS_EXPR : 
PLUS_EXPR,
                                TREE_TYPE (m_constant),
                                m_constant, integer_one_node);
       gcc_assert (CONSTANT_CLASS_P (m_constant));
@@ -290,15 +290,15 @@ range::above_upper_bound (tree rhs_const) const
    Return true if feasible; false if infeasible.  */
 
 bool
-range::add_bound (bound b, enum bound_kind bound_kind)
+range::add_bound (bound b, enum bound_kind bnd_kind)
 {
   /* Bail out on floating point constants.  */
   if (!INTEGRAL_TYPE_P (TREE_TYPE (b.m_constant)))
     return true;
 
-  b.ensure_closed (bound_kind);
+  b.ensure_closed (bnd_kind);
 
-  switch (bound_kind)
+  switch (bnd_kind)
     {
     default:
       gcc_unreachable ();
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index 32c72dc2076a..23e344d87e4a 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -346,10 +346,10 @@ class exploded_node : public dnode<eg_traits>
   void dump_succs_and_preds (FILE *outf) const;
 
   enum status get_status () const { return m_status; }
-  void set_status (enum status status)
+  void set_status (enum status s)
   {
     gcc_assert (m_status == status::worklist);
-    m_status = status;
+    m_status = s;
   }
 
   void add_diagnostic (const saved_diagnostic *sd)

Reply via email to