From 0f397606a181c9aa5d5e7dfb8f8c1b221d16747d Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Fri, 28 Feb 2014 11:38:34 +0100 Subject: [PATCH] Fix detection of entities of different kinds for diff purposes * src/abg-comparison.cc (distinct_diff::entities_are_of_distinct_kinds): Consider two NULL decls are distinct types for the purpose of diffing. This is just a shortcut to avoid creating a null_diff type for now. But then, stop considering same pointers as different. This was a bug. Signed-off-by: Dodji Seketeli --- src/abg-comparison.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 8699ebb5..8a0b61d5 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -272,7 +272,8 @@ const decl_base_sptr distinct_diff::second() const {return second_subject();} -/// Test if the two arguments are of different kind. +/// Test if the two arguments are of different kind, or that are both +/// NULL. /// /// @param first the first argument to test for similarity in kind. /// @@ -285,8 +286,12 @@ distinct_diff::entities_are_of_distinct_kinds(decl_base_sptr first, { if (!!first != !!second) return true; - if (first == second) + if (!first && !second) + // We do consider diffs of two empty decls as a diff of distinct + // kinds, for now. return true; + if (first == second) + return false; return typeid(*first.get()) != typeid(*second.get()); }