From patchwork Thu Jun 10 08:11:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 43801 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF7963AAA066 for ; Thu, 10 Jun 2021 08:11:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF7963AAA066 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623312708; bh=58uBvKsgrtGp5WGuJc75BxWMNp+vQgsGC9NCtKq9YFk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=ADTMqu3BnPdg1tgXmT+3PkPKS+QtWjXOn3sl+Zo2EQYoc542N+1LnBk9Kshh0Of+o zYeaMU+MJtJ/74zM7rBq1rHSwZYMoY4eTvdYdWVrCCkSzlCMflbasWbX/dMZp7tksf 8hfVN/4i/zMvC19yZmUBKHmWLhIUsvvtdWcoV2Os= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 0B55A3AA9C5B for ; Thu, 10 Jun 2021 08:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B55A3AA9C5B Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-442-VzHsY5hzP6esYtY04oEKcw-1; Thu, 10 Jun 2021 04:11:28 -0400 X-MC-Unique: VzHsY5hzP6esYtY04oEKcw-1 Received: by mail-wr1-f71.google.com with SMTP id n2-20020adfb7420000b029010e47b59f31so512508wre.9 for ; Thu, 10 Jun 2021 01:11:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=58uBvKsgrtGp5WGuJc75BxWMNp+vQgsGC9NCtKq9YFk=; b=n753aLqn1/uzk2HDskLY80b35fZjbEhLSocQm73Sq21pOvod+PR378E0E09pTzQVOg Izjyyn2ROvrfoZQxwI9o3aHEqDJL8sbp8v0sScSQHpS9gsvL/vctGE2NLpoFLKUW6cOu pFLYQurXwGe49A9W0vXSDs722whMXMMva8a1QWTjlyk+d2wuTYidWfuQDQgpA8Tc2WI/ 1Kyw4R/pz/dlo//0dE862AqYQK4l/rxHXHM4AH1TYzw6P6DVvS2BmYYTDfjuEM+Yesq+ bfVA6zky82qcnQEhdoLGku3ZmAfcwciHXj/Cjol9VfR17a6NueJxyZeGGoVmm7lueuII kn8A== X-Gm-Message-State: AOAM532ertOIxAasuDu1px/QSKbR1YLRPCorF4fTuieeHtLBuJiR91JT M25U1Eo0aC22YftEBAPgnYcrhucu+gcz8k00VUvWKCYjYlE0cjeL9ro6e+j4ZXmCV9HFsAK9C90 nJ39dqINYwhM+YJkSUbTEUDUrkAVLU8eJ6PfbBOZU5Fv5NzPIkYVPe6xfxbv027j0BEqC X-Received: by 2002:adf:ea49:: with SMTP id j9mr3877996wrn.366.1623312686586; Thu, 10 Jun 2021 01:11:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxblF02nDp77dw4UMDhYy1iCwkgex7umHBRlwaakIjleAIONP+wN1fhUo0as89gN24+lMlQ0g== X-Received: by 2002:adf:ea49:: with SMTP id j9mr3877956wrn.366.1623312686185; Thu, 10 Jun 2021 01:11:26 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id h6sm2581274wrt.20.2021.06.10.01.11.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 01:11:25 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id BBC095800FF; Thu, 10 Jun 2021 10:11:03 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Enable setting breakpoint on first type inequality Organization: Red Hat / France X-Operating-System: Fedora 35 X-URL: http://www.redhat.com Date: Thu, 10 Jun 2021 10:11:03 +0200 Message-ID: <874ke63zs8.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, When debugging type canonicalization in type_base::get_canonical_type_for, I more often than not want to know why a type compares different to another. Until now, I've been doing that by stepping in the debugger. I figure a much efficient way of doing that is to be able to set a breakpoint on the first occurrence of type inequality. To do that, I am adding a few macros to use in the 'equals' functions to return their value: ABG_RETURN(value), ABG_RETURN_REQUAL(l,r) and ABG_RETURN_FALSE. Those invoke a new function called 'notify_equality_failed' when the result of the comparison is false. This allows to just set a debugger breakpoint on 'notify_equality_failed' to know when and why the type comparison fails. These macros invoke notify_equality_failed only if the WITH_DEBUG_SELF_COMPARISON macro is defined. Otherwise, they do what the code was doing previously. Said otherwise, this whole shebang is enabled only when the code is configured with --enable-debug-self-comparison. This patch incurs no functional change. * src/abg-ir.cc (notify_equality_failed): Define new static function if WITH_DEBUG_SELF_COMPARISON is defined. (ABG_RETURN_EQUAL, ABG_RETURN_FALSE, ABG_RETURN): Define new macros. (try_canonical_compare): Use ABG_RETURN_EQUAL rather than just returning the result of a comparison. (equals): In all the overloads, use the new ABG_RETURN* macros, rather than just returning boolean values. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 274 +++++++++++++++++++++++++++++++------------------- 1 file changed, 172 insertions(+), 102 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 5963a7cd..bd4c6543 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -649,6 +649,76 @@ struct type_name_comp {return operator()(type_base_sptr(l), type_base_sptr(r));} }; // end struct type_name_comp +#ifdef WITH_DEBUG_SELF_COMPARISON + +/// This is a function called when the ABG_RETURN* macros defined +/// below return false. +/// +/// The purpose of this function is to ease debugging. To know where +/// the equality functions first compare non-equal, we can just set a +/// breakpoint on this notify_equality_failed function and run the +/// equality functions. Because all the equality functions use the +/// ABG_RETURN* macros to return their values, this function is always +/// called when any of those equality function return false. +/// +/// @param l the first operand of the equality. +/// +/// @param r the second operand of the equality. +static void +notify_equality_failed(const type_or_decl_base &l __attribute__((unused)), + const type_or_decl_base &r __attribute__((unused))) +{} + +/// This is a function called when the ABG_RETURN* macros defined +/// below return false. +/// +/// The purpose of this function is to ease debugging. To know where +/// the equality functions first compare non-equal, we can just set a +/// breakpoint on this notify_equality_failed function and run the +/// equality functions. Because all the equality functions use the +/// ABG_RETURN* macros to return their values, this function is always +/// called when any of those equality function return false. +/// +/// @param l the first operand of the equality. +/// +/// @param r the second operand of the equality. +static void +notify_equality_failed(const type_or_decl_base *l __attribute__((unused)), + const type_or_decl_base *r __attribute__((unused))) +{} + +#define ABG_RETURN_EQUAL(l, r) \ + do \ + { \ + if (l != r) \ + notify_equality_failed(l, r); \ + return (l == r); \ + } \ + while(false) + + +#define ABG_RETURN_FALSE \ + do \ + { \ + notify_equality_failed(l, r); \ + return false; \ + } while(false) + +#define ABG_RETURN(value) \ + do \ + { \ + if (value == false) \ + notify_equality_failed(l, r); \ + return value; \ + } while (false) + +#else // WITH_DEBUG_SELF_COMPARISON + +#define ABG_RETURN_FALSE return false +#define ABG_RETURN(value) return (value) +#define ABG_RETURN_EQUAL(l, r) return ((l) == (r)); +#endif + /// Compare two types by comparing their canonical types if present. /// /// If the canonical types are not present (because the types have not @@ -664,7 +734,7 @@ try_canonical_compare(const T *l, const T *r) { if (const type_base *lc = l->get_naked_canonical_type()) if (const type_base *rc = r->get_naked_canonical_type()) - return lc == rc; + ABG_RETURN_EQUAL(lc, rc); return equals(*l, *r, 0); } @@ -4551,7 +4621,7 @@ equals(const decl_base& l, const decl_base& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } } } @@ -4592,12 +4662,12 @@ equals(const decl_base& l, const decl_base& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } result &= maybe_compare_as_member_decls(l, r, k); - return result; + ABG_RETURN(result); } /// Return true iff the two decls have the same name. @@ -7007,7 +7077,7 @@ equals(const scope_decl& l, const scope_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } scope_decl::declarations::const_iterator i, j; @@ -7024,7 +7094,7 @@ equals(const scope_decl& l, const scope_decl& r, change_kind* k) break; } else - return false; + ABG_RETURN_FALSE; } } @@ -7034,10 +7104,10 @@ equals(const scope_decl& l, const scope_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } /// Return true iff both scopes have the same names and have the same @@ -13419,7 +13489,7 @@ equals(const type_base& l, const type_base& r, change_kind* k) if (!result) if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return result; + ABG_RETURN(result); } /// Return true iff both type declarations are equal. @@ -13880,12 +13950,12 @@ equals(const type_decl& l, const type_decl& r, change_kind* k) static_cast(r), k); if (!k && !result) - return false; + ABG_RETURN_FALSE; result &= equals(static_cast(l), static_cast(r), k); - return result; + ABG_RETURN(result); } /// Return true if both types equals. @@ -14071,13 +14141,13 @@ equals(const scope_type_decl& l, const scope_type_decl& r, change_kind* k) k); if (!k && !result) - return false; + ABG_RETURN_FALSE; result &= equals(static_cast(l), static_cast(r), k); - return result; + ABG_RETURN(result); } /// Equality operator between two scope_type_decl. @@ -14457,7 +14527,7 @@ equals(const qualified_type_def& l, const qualified_type_def& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } if (l.get_underlying_type() != r.get_underlying_type()) @@ -14479,10 +14549,10 @@ equals(const qualified_type_def& l, const qualified_type_def& r, change_kind* k) // putting it here to maintenance; that is, so that adding // subsequent clauses needed to compare two qualified types // later still works. - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } /// Equality operator for qualified types. @@ -14939,7 +15009,7 @@ equals(const pointer_type_def& l, const pointer_type_def& r, change_kind* k) *k |= SUBTYPE_CHANGE_KIND; } - return result; + ABG_RETURN(result); } /// Return true iff both instances of pointer_type_def are equal. @@ -15312,7 +15382,7 @@ equals(const reference_type_def& l, const reference_type_def& r, change_kind* k) { if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return false; + ABG_RETURN_FALSE; } // Compare the pointed-to-types modulo the typedefs they might have @@ -15325,7 +15395,7 @@ equals(const reference_type_def& l, const reference_type_def& r, change_kind* k) *k |= LOCAL_TYPE_CHANGE_KIND; *k |= SUBTYPE_CHANGE_KIND; } - return result; + ABG_RETURN(result); } /// Equality operator of the @ref reference_type_def type. @@ -15859,7 +15929,7 @@ equals(const array_type_def::subrange_type& l, if (k) *k |= LOCAL_TYPE_CHANGE_KIND; else - return result; + ABG_RETURN(result); } #if 0 @@ -15877,10 +15947,10 @@ equals(const array_type_def::subrange_type& l, *k |= SUBTYPE_CHANGE_KIND; } else - return result; + ABG_RETURN(result); } #endif - return result; + ABG_RETURN(result); } /// Equality operator. @@ -16118,7 +16188,7 @@ equals(const array_type_def& l, const array_type_def& r, change_kind* k) if (k) *k |= LOCAL_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } std::vector::const_iterator i,j; @@ -16134,7 +16204,7 @@ equals(const array_type_def& l, const array_type_def& r, change_kind* k) break; } else - return false; + ABG_RETURN_FALSE; } // Compare the element types modulo the typedefs they might have @@ -16145,10 +16215,10 @@ equals(const array_type_def& l, const array_type_def& r, change_kind* k) if (k) *k |= SUBTYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } /// Test if two variables are equals modulo CV qualifiers. @@ -16166,7 +16236,7 @@ equals_modulo_cv_qualifier(const array_type_def* l, const array_type_def* r) return true; if (!l || !r) - return false; + ABG_RETURN_FALSE; l = is_array_type(peel_qualified_or_typedef_type(l)); r = is_array_type(peel_qualified_or_typedef_type(r)); @@ -16175,14 +16245,14 @@ equals_modulo_cv_qualifier(const array_type_def* l, const array_type_def* r) std::vector other_subs = r->get_subranges(); if (this_subs.size() != other_subs.size()) - return false; + ABG_RETURN_FALSE; std::vector::const_iterator i,j; for (i = this_subs.begin(), j = other_subs.begin(); i != this_subs.end() && j != other_subs.end(); ++i, ++j) if (**i != **j) - return false; + ABG_RETURN_FALSE; type_base *first_element_type = peel_qualified_or_typedef_type(l->get_element_type().get()); @@ -16190,7 +16260,7 @@ equals_modulo_cv_qualifier(const array_type_def* l, const array_type_def* r) peel_qualified_or_typedef_type(r->get_element_type().get()); if (*first_element_type != *second_element_type) - return false; + ABG_RETURN_FALSE; return true; } @@ -16634,7 +16704,7 @@ equals(const enum_type_decl& l, const enum_type_decl& r, change_kind* k) if (k) *k |= SUBTYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } enum_type_decl::enumerators::const_iterator i, j; @@ -16650,7 +16720,7 @@ equals(const enum_type_decl& l, const enum_type_decl& r, change_kind* k) break; } else - return false; + ABG_RETURN_FALSE; } if (i != l.get_enumerators().end() || j != r.get_enumerators().end()) @@ -16659,7 +16729,7 @@ equals(const enum_type_decl& l, const enum_type_decl& r, change_kind* k) if (k) *k |= LOCAL_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } if (!(l.decl_base::operator==(r) && l.type_base::operator==(r))) @@ -16673,7 +16743,7 @@ equals(const enum_type_decl& l, const enum_type_decl& r, change_kind* k) *k |= LOCAL_TYPE_CHANGE_KIND; } else - return false; + ABG_RETURN_FALSE; } return result; @@ -17056,7 +17126,7 @@ equals(const typedef_decl& l, const typedef_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } if (*l.get_underlying_type() != *r.get_underlying_type()) @@ -17067,10 +17137,10 @@ equals(const typedef_decl& l, const typedef_decl& r, change_kind* k) if (k) *k |= LOCAL_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } /// Equality operator @@ -17371,7 +17441,7 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) *k |= SUBTYPE_CHANGE_KIND; } else - return false; + ABG_RETURN_FALSE; } // If there are underlying elf symbols for these variables, @@ -17383,7 +17453,7 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } else if (s0 && s0 != s1) { @@ -17391,7 +17461,7 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } bool symbols_are_equal = (s0 && s1 && result); @@ -17413,7 +17483,7 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } } else @@ -17423,7 +17493,7 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } const dm_context_rel* c0 = @@ -17438,10 +17508,10 @@ equals(const var_decl& l, const var_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } /// Comparison operator of @ref var_decl. @@ -17963,29 +18033,29 @@ function_type::is_variadic() const /// ///@return true if lhs == rhs, false otherwise. bool -equals(const function_type& lhs, - const function_type& rhs, +equals(const function_type& l, + const function_type& r, change_kind* k) { #define RETURN(value) \ do { \ - lhs.priv_->unmark_as_being_compared(lhs); \ - lhs.priv_->unmark_as_being_compared(rhs); \ + l.priv_->unmark_as_being_compared(l); \ + l.priv_->unmark_as_being_compared(r); \ if (value == true) \ - maybe_propagate_canonical_type(lhs, rhs); \ - return value; \ + maybe_propagate_canonical_type(l, r); \ + ABG_RETURN(value); \ } while(0) - if (lhs.priv_->comparison_started(lhs) - || lhs.priv_->comparison_started(rhs)) + if (l.priv_->comparison_started(l) + || l.priv_->comparison_started(r)) return true; - lhs.priv_->mark_as_being_compared(lhs); - lhs.priv_->mark_as_being_compared(rhs); + l.priv_->mark_as_being_compared(l); + l.priv_->mark_as_being_compared(r); bool result = true; - if (!lhs.type_base::operator==(rhs)) + if (!l.type_base::operator==(r)) { result = false; if (k) @@ -17994,16 +18064,16 @@ equals(const function_type& lhs, RETURN(result); } - class_or_union* lhs_class = 0, *rhs_class = 0; - if (const method_type* m = dynamic_cast(&lhs)) - lhs_class = m->get_class_type().get(); + class_or_union* l_class = 0, *r_class = 0; + if (const method_type* m = dynamic_cast(&l)) + l_class = m->get_class_type().get(); - if (const method_type* m = dynamic_cast(&rhs)) - rhs_class = m->get_class_type().get(); + if (const method_type* m = dynamic_cast(&r)) + r_class = m->get_class_type().get(); // Compare the names of the class of the method - if (!!lhs_class != !!rhs_class) + if (!!l_class != !!r_class) { result = false; if (k) @@ -18011,9 +18081,9 @@ equals(const function_type& lhs, else RETURN(result); } - else if (lhs_class - && (lhs_class->get_qualified_name() - != rhs_class->get_qualified_name())) + else if (l_class + && (l_class->get_qualified_name() + != r_class->get_qualified_name())) { result = false; if (k) @@ -18026,32 +18096,32 @@ equals(const function_type& lhs, // that is the same as the method class name; we can recurse for // ever in that case. - decl_base* lhs_return_type_decl = - get_type_declaration(lhs.get_return_type()).get(); - decl_base* rhs_return_type_decl = - get_type_declaration(rhs.get_return_type()).get(); + decl_base* l_return_type_decl = + get_type_declaration(l.get_return_type()).get(); + decl_base* r_return_type_decl = + get_type_declaration(r.get_return_type()).get(); bool compare_result_types = true; - string lhs_rt_name = lhs_return_type_decl - ? lhs_return_type_decl->get_qualified_name() + string l_rt_name = l_return_type_decl + ? l_return_type_decl->get_qualified_name() : string(); - string rhs_rt_name = rhs_return_type_decl - ? rhs_return_type_decl->get_qualified_name() + string r_rt_name = r_return_type_decl + ? r_return_type_decl->get_qualified_name() : string(); - if ((lhs_class && (lhs_class->get_qualified_name() == lhs_rt_name)) + if ((l_class && (l_class->get_qualified_name() == l_rt_name)) || - (rhs_class && (rhs_class->get_qualified_name() == rhs_rt_name))) + (r_class && (r_class->get_qualified_name() == r_rt_name))) compare_result_types = false; if (compare_result_types) { - if (lhs.get_return_type() != rhs.get_return_type()) + if (l.get_return_type() != r.get_return_type()) { result = false; if (k) { - if (!types_have_similar_structure(lhs.get_return_type(), - rhs.get_return_type())) + if (!types_have_similar_structure(l.get_return_type(), + r.get_return_type())) *k |= LOCAL_TYPE_CHANGE_KIND; else *k |= SUBTYPE_CHANGE_KIND; @@ -18061,7 +18131,7 @@ equals(const function_type& lhs, } } else - if (lhs_rt_name != rhs_rt_name) + if (l_rt_name != r_rt_name) { result = false; if (k) @@ -18071,8 +18141,8 @@ equals(const function_type& lhs, } vector >::const_iterator i,j; - for (i = lhs.get_first_parm(), j = rhs.get_first_parm(); - i != lhs.get_parameters().end() && j != rhs.get_parameters().end(); + for (i = l.get_first_parm(), j = r.get_first_parm(); + i != l.get_parameters().end() && j != r.get_parameters().end(); ++i, ++j) { if (**i != **j) @@ -18091,8 +18161,8 @@ equals(const function_type& lhs, } } - if ((i != lhs.get_parameters().end() - || j != rhs.get_parameters().end())) + if ((i != l.get_parameters().end() + || j != r.get_parameters().end())) { result = false; if (k) @@ -18859,7 +18929,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) *k |= SUBTYPE_CHANGE_KIND; } else - return false; + ABG_RETURN_FALSE; } const elf_symbol_sptr &s0 = l.get_symbol(), &s1 = r.get_symbol(); @@ -18869,7 +18939,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } else if (s0 && s0 != s1) { @@ -18879,7 +18949,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } } bool symbols_are_equal = (s0 && s1 && result); @@ -18909,7 +18979,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } } else @@ -18919,7 +18989,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } // Compare the remaining properties @@ -18930,7 +19000,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } if (is_member_function(l) != is_member_function(r)) @@ -18939,7 +19009,7 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } if (is_member_function(l) && is_member_function(r)) @@ -18961,11 +19031,11 @@ equals(const function_decl& l, const function_decl& r, change_kind* k) if (k) *k |= LOCAL_NON_TYPE_CHANGE_KIND; else - return false; + ABG_RETURN_FALSE; } } - return result; + ABG_RETURN(result); } /// Comparison operator for @ref function_decl. @@ -19310,7 +19380,7 @@ equals(const function_decl::parameter& l, *k |= LOCAL_TYPE_CHANGE_KIND; } else - return false; + ABG_RETURN_FALSE; } @@ -19329,10 +19399,10 @@ equals(const function_decl::parameter& l, *k |= SUBTYPE_CHANGE_KIND; } else - return false; + ABG_RETURN_FALSE; } - return result; + ABG_RETURN(result); } bool @@ -20542,7 +20612,7 @@ equals(const class_or_union& l, const class_or_union& r, change_kind* k) do { \ l.priv_->unmark_as_being_compared(l); \ l.priv_->unmark_as_being_compared(r); \ - return value; \ + ABG_RETURN(value); \ } while(0) // if one of the classes is declaration-only, look through it to @@ -20596,7 +20666,7 @@ equals(const class_or_union& l, const class_or_union& r, change_kind* k) // we haven't marked l or r as being compared yet, and // doing so has a peformance cost that shows up on // performance profiles for *big* libraries. - return false; + ABG_RETURN_FALSE; } } else // A decl-only class is considered different from a @@ -20606,7 +20676,7 @@ equals(const class_or_union& l, const class_or_union& r, change_kind* k) { if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return false; + ABG_RETURN_FALSE; } // both definitions are empty @@ -20615,7 +20685,7 @@ equals(const class_or_union& l, const class_or_union& r, change_kind* k) { if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return false; + ABG_RETURN_FALSE; } return true; @@ -20642,7 +20712,7 @@ equals(const class_or_union& l, const class_or_union& r, change_kind* k) { if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return false; + ABG_RETURN_FALSE; } if (types_defined_same_linux_kernel_corpus_public(l, r)) @@ -21481,7 +21551,7 @@ equals(const class_decl::base_spec& l, { if (k) *k |= LOCAL_TYPE_CHANGE_KIND; - return false; + ABG_RETURN_FALSE; } return (*l.get_base_class() == *r.get_base_class()); @@ -22125,7 +22195,7 @@ equals(const class_decl& l, const class_decl& r, change_kind* k) l.class_or_union::priv_->unmark_as_being_compared(r); \ if (value == true) \ maybe_propagate_canonical_type(l, r); \ - return value; \ + ABG_RETURN(value); \ } while(0) // Compare bases. @@ -23224,7 +23294,7 @@ equals(const union_decl& l, const union_decl& r, change_kind* k) k); if (result == true) maybe_propagate_canonical_type(l, r); - return result; + ABG_RETURN(result); } /// Copy a method of a @ref union_decl into a new @ref