Avoid infinite loops in the comparison code for classes

* src/abg-ir.cc (equals): In the overload for classes, make sure
	to store the name of the lhs of the class and the rhs into the
	lhs.  Also, when we bail out because we detect that there is a
	comparison underway, do *not* unmark the current class as not being
	involved in the comparison.  Also, break at the first lhs virtual
	member function that is different from the rhs counter part.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-10-16 22:38:04 +02:00
parent a8b00c0892
commit 06db1895ff

View File

@ -6818,8 +6818,8 @@ equals(const class_decl& l, const class_decl& r, change_kind& k)
{
#define RETURN(value) \
do { \
l.priv_->unmark_as_being_compared(&l); \
l.priv_->unmark_as_being_compared(&r); \
l.priv_->unmark_as_being_compared(l); \
l.priv_->unmark_as_being_compared(r); \
return value; \
} while(0)
@ -6850,9 +6850,9 @@ equals(const class_decl& l, const class_decl& r, change_kind& k)
RETURN(true);
}
if (l.priv_->comparison_started(&l)
|| l.priv_->comparison_started(&r))
RETURN(true);
if (l.priv_->comparison_started(l)
|| l.priv_->comparison_started(r))
return true;
l.priv_->mark_as_being_compared(l);
l.priv_->mark_as_being_compared(r);
@ -6871,12 +6871,12 @@ equals(const class_decl& l, const class_decl& r, change_kind& k)
RETURN(false);
}
if (l.priv_->comparison_started(&l)
|| l.priv_->comparison_started(&r))
RETURN(true);
if (l.priv_->comparison_started(l)
|| l.priv_->comparison_started(r))
return true;
l.priv_->mark_as_being_compared(&l);
l.priv_->mark_as_being_compared(&r);
l.priv_->mark_as_being_compared(l);
l.priv_->mark_as_being_compared(r);
bool result = true;
@ -6943,6 +6943,7 @@ equals(const class_decl& l, const class_decl& r, change_kind& k)
{
k |= SUBTYPE_CHANGE_KIND;
result = false;
break;
}
}