[applied] Fix compilation with Clang

Message ID 87wm6wvpw3.fsf@redhat.com
State New
Headers
Series [applied] Fix compilation with Clang |

Commit Message

Dodji Seketeli Aug. 21, 2025, 12:08 p.m. UTC
  Hello,

	* include/abg-comparison.h (class type_diff_base): Remove private
	default constructor.  Rather, declare it as a deleted default
	constructor.
	(class ptr_to_mbr_diff): The default contructor is deleted, not
	defaulted.
	* src/abg-dwarf-reader.cc (get_die_qualified_name): Remove unused
	function.
	(die_enum_flat_representation): Add missing parenthesis around
	"?:" expression coming after the << operator.
	* src/abg-ir.cc (collect_non_anonymous_data_members): Fix unused
	variable.
	* src/abg-suppression.cc (is_negated_suppression): Fix expression
	that might not be evaluated.
	* src/abg-tools-utils.cc (ANONYMOUS_SUBRANGE_INTERNAL_NAME_LEN):
	Remove useless static variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the mainline.
---
 include/abg-comparison.h |  6 +++---
 src/abg-dwarf-reader.cc  | 24 ++++--------------------
 src/abg-ir.cc            |  2 +-
 src/abg-suppression.cc   |  4 +++-
 src/abg-tools-utils.cc   |  3 ---
 5 files changed, 11 insertions(+), 28 deletions(-)
  

Patch

diff --git a/include/abg-comparison.h b/include/abg-comparison.h
index f4194002..b4ae3f5f 100644
--- a/include/abg-comparison.h
+++ b/include/abg-comparison.h
@@ -1188,8 +1188,6 @@  class type_diff_base : public diff
   struct priv;
   std::unique_ptr<priv> priv_;
 
-  type_diff_base();
-
 protected:
   type_diff_base(type_base_sptr	first_subject,
 		 type_base_sptr	second_subject,
@@ -1197,6 +1195,8 @@  protected:
 
 public:
 
+  type_diff_base() = delete;
+
   virtual enum change_kind
   has_local_changes() const = 0;
 
@@ -1454,7 +1454,7 @@  class ptr_to_mbr_diff : public type_diff_base
   struct priv;
   std::unique_ptr<priv> priv_;
 
-  ptr_to_mbr_diff()  = default;
+  ptr_to_mbr_diff()  = delete;
 
 protected:
   ptr_to_mbr_diff(const ptr_to_mbr_type_sptr& first,
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index f1fdc1d3..1c0597f9 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -3287,25 +3287,6 @@  public:
     return i->second;
   }
 
-  /// Get the qualified name of a given DIE.
-  ///
-  /// If the name of the DIE was already computed before just return
-  /// that name from a cache.  Otherwise, build the name, cache it and
-  /// return it.
-  ///
-  /// @param die the DIE to consider.
-  ///
-  /// @param where_offset where in the DIE stream we logically are.
-  ///
-  /// @return the interned string representing the qualified name of
-  /// @p die.
-  interned_string
-  get_die_qualified_name(Dwarf_Die *die, size_t where_offset) const
-  {
-    return const_cast<reader*>(this)->
-      get_die_qualified_name(die, where_offset);
-  }
-
   /// Get the qualified name of a given DIE which is considered to be
   /// the DIE for a type.
   ///
@@ -10994,7 +10975,10 @@  die_enum_flat_representation(const reader&	rdr,
       while (dwarf_siblingof(&child, &child) == 0);
     }
 
-  o << one_line ? string("}") : "\n" + indent;
+  o << (one_line
+	? string("}")
+	: "\n" + indent);
+
   o << "}";
 
   return o.str();
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 0a2ce5a1..de0703ec 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -5840,7 +5840,7 @@  collect_non_anonymous_data_members(const class_or_union* cou,
 	  result = true;
 	}
     }
-  return true;
+  return result;
 }
 
 /// Collect all the non-anonymous data members of a class or union type.
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 534d32c6..15785ac5 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -312,7 +312,9 @@  is_negated_suppression(const suppression_base& s)
   bool result = true;
   try
     {
-      dynamic_cast<const negated_suppression_base&>(s);
+      if (const negated_suppression_base* s_prime =
+	   &dynamic_cast<const negated_suppression_base&>(s))
+	return !!s_prime;
     }
   catch (...)
     {
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 68585998..0b72d670 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -615,9 +615,6 @@  const char*
 get_anonymous_union_internal_name_prefix()
 {return ANONYMOUS_UNION_INTERNAL_NAME;}
 
-static int ANONYMOUS_SUBRANGE_INTERNAL_NAME_LEN =
-  strlen(ANONYMOUS_SUBRANGE_INTERNAL_NAME);
-
 /// Getter of the prefix for the name of anonymous enums.
 ///
 /// @reaturn the prefix for the name of anonymous enums.