[PATCH] abg-corpus.cc: report architecture discrepancies

Giuliano Procida gprocida@google.com
Fri Sep 18 10:00:54 GMT 2020


If there ever is a discrepancy between the architectures of the
corpuses of a corpus group, libabigail will just abort with an
assertion, if enabled. However, this is a case of invalid input and
the cause should be reported to the user.

	* src/abg-corpus.cc (corpus_group::add_corpus): Report
	architecture discrepancies.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-corpus.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index 1f72904d1..67f878dd6 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -1647,8 +1647,13 @@ corpus_group::add_corpus(const corpus_sptr& corp)
     corp_arch = corp->get_architecture_name();
   if (cur_arch.empty())
     set_architecture_name(corp_arch);
-  else
-    ABG_ASSERT(cur_arch == corp_arch);
+  else if (cur_arch != corp_arch)
+    {
+      std::cerr << "corpus '" << corp->get_path() << "'"
+		<< " has architecture '" << corp_arch << "'"
+		<< " but expected '" << cur_arch << "'\n";
+      ABG_ASSERT_NOT_REACHED;
+    }
 
   priv_->corpora.push_back(corp);
   corp->set_group(this);
-- 
2.28.0.681.g6f77f65b4e-goog



More information about the Libabigail mailing list