public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] abidiff,reader: Fix compilation with --debug-self-comparison
@ 2023-04-14 13:38 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-04-14 13:38 UTC (permalink / raw)
  To: libabigail

Hello,

While chasing self-comparison changes errors, I realized that
compilation is failing when the package is configured with
--debug-self-comparison.

Fixed thus.

	* src/abg-reader.cc
	(reader::{maybe_check_abixml_canonical_type_stability, read_corpus}):
	get_environment() doesn't returns a pointer anymore.  So adapt the
	code.
	(maybe_map_type_with_type_id): Adjust because the environment is
	const.
	(load_canonical_type_ids): The xml_reader namespace doesn't exist
	anymore.  It's now abixml.
	* tools/abidiff.cc (options::options): Initialize the
	do_debug_self_comparison data member before the use_btf one, as it
	should be.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-reader.cc | 28 +++++++++++++---------------
 tools/abidiff.cc  |  8 ++++----
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index e1d13296..fe3d466b 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -851,8 +851,8 @@ public:
   void
   maybe_check_abixml_canonical_type_stability(type_base_sptr& t)
   {
-    if (!get_environment()->self_comparison_debug_is_on()
-	|| get_environment()->get_type_id_canonical_type_map().empty())
+    if (!get_environment().self_comparison_debug_is_on()
+	|| get_environment().get_type_id_canonical_type_map().empty())
       return ;
 
     if (class_decl_sptr c = is_class_type(t))
@@ -864,15 +864,15 @@ public:
     // Let's get the type-id of this type as recorded in the
     // originating abixml file.
     string type_id =
-      get_environment()->get_type_id_from_pointer(reinterpret_cast<uintptr_t>(t.get()));
+      get_environment().get_type_id_from_pointer(reinterpret_cast<uintptr_t>(t.get()));
 
     if (!type_id.empty())
       {
 	// Now let's get the canonical type that initially led to the
 	// serialization of a type with this type-id, when the abixml
 	// was being serialized.
-	auto j = get_environment()->get_type_id_canonical_type_map().find(type_id);
-	if (j == get_environment()->get_type_id_canonical_type_map().end())
+	auto j = get_environment().get_type_id_canonical_type_map().find(type_id);
+	if (j == get_environment().get_type_id_canonical_type_map().end())
 	  {
 	    if (t->get_naked_canonical_type())
 	      std::cerr << "error: no type with type-id: '"
@@ -1107,9 +1107,8 @@ public:
 	  return nil;
 
 #ifdef WITH_DEBUG_SELF_COMPARISON
-	if (get_environment()->self_comparison_debug_is_on())
-	  get_environment()->
-	    set_self_comparison_debug_input(corpus());
+	if (get_environment().self_comparison_debug_is_on())
+	  get_environment().set_self_comparison_debug_input(corpus());
 #endif
 
 	if (!corpus_group())
@@ -1168,9 +1167,8 @@ public:
     else
       {
 #ifdef WITH_DEBUG_SELF_COMPARISON
-	if (get_environment()->self_comparison_debug_is_on())
-	  get_environment()->
-	    set_self_comparison_debug_input(corpus());
+	if (get_environment().self_comparison_debug_is_on())
+	  get_environment().set_self_comparison_debug_input(corpus());
 #endif
 
 	if (!corpus_group())
@@ -2929,8 +2927,8 @@ maybe_map_type_with_type_id(const type_base_sptr& t,
       || is_non_canonicalized_type(t.get()))
     return false;
 
-  env.get_pointer_type_id_map()[reinterpret_cast<uintptr_t>(t.get())] =
-    type_id;
+  const_cast<environment&>(env).
+    get_pointer_type_id_map()[reinterpret_cast<uintptr_t>(t.get())] = type_id;
 
   return true;
 }
@@ -6243,7 +6241,7 @@ read_corpus_from_abixml_file(const string& path,
 bool
 load_canonical_type_ids(fe_iface& iface, const string &file_path)
 {
-  xml_reader::reader& rdr = dynamic_cast<xml_reader::reader&>(iface)
+  abixml::reader& rdr = dynamic_cast<abixml::reader&>(iface);
 
   xmlDocPtr doc = xmlReadFile(file_path.c_str(), NULL, XML_PARSE_NOERROR);
   if (!doc)
@@ -6302,7 +6300,7 @@ load_canonical_type_ids(fe_iface& iface, const string &file_path)
 	      // that are not canonicalized.  Look into function
 	      // hash_as_canonical_type_or_constant for the details.
 	      && v != 0xdeadbabe)
-	    rdr.get_environment()->get_type_id_canonical_type_map()[id] = v;
+	    rdr.get_environment().get_type_id_canonical_type_map()[id] = v;
 	}
     }
   return true;
diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 427c1f19..0e6538eb 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -175,6 +175,10 @@ struct options
       dump_diff_tree(),
       show_stats(),
       do_log()
+#ifdef WITH_DEBUG_SELF_COMPARISON
+    ,
+      do_debug_self_comparison()
+#endif
 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
     ,
       do_debug_type_canonicalization()
@@ -186,10 +190,6 @@ struct options
 #ifdef WITH_BTF
     ,
       use_btf()
-#endif
-#ifdef WITH_DEBUG_SELF_COMPARISON
-    ,
-      do_debug_self_comparison()
 #endif
   {}
 
-- 
2.39.1


-- 
		Dodji


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-14 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 13:38 [PATCH, applied] abidiff,reader: Fix compilation with --debug-self-comparison Dodji Seketeli

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).