From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] abidiff,reader: Fix compilation with --debug-self-comparison
Date: Fri, 14 Apr 2023 15:38:03 +0200 [thread overview]
Message-ID: <87leiutwhw.fsf@redhat.com> (raw)
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
reply other threads:[~2023-04-14 13:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87leiutwhw.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).