From patchwork Mon Oct 10 11:59:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 58585 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 BDF9838582B9 for ; Mon, 10 Oct 2022 11:59:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDF9838582B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665403187; bh=OAuPtDgC5gnjxk2GOkjq6fivFTVTAY/1MhEJ42Zb9QE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=FHnH1zD6EZcuoBJukzAVnq772y8V4KROnNCYUFTsgZiicTNFt1hXAJ3dMVGTxF/bB v58QE8lKhhjkoyfpjdfGeoZYryT826MnLksX4cBCbuWg7gth3hbima1H+a7p6mz5S0 P9cyavvrp/JCKtCR8T5RAeiZq0XQmLUVsIdU+ESQ= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 1A56F385840A for ; Mon, 10 Oct 2022 11:59:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A56F385840A Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-595-z5osE6nEPPuGk5Dy6wJc9g-1; Mon, 10 Oct 2022 07:59:20 -0400 X-MC-Unique: z5osE6nEPPuGk5Dy6wJc9g-1 Received: by mail-wr1-f69.google.com with SMTP id l16-20020adfc790000000b00230c2505f96so479862wrg.4 for ; Mon, 10 Oct 2022 04:59:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OAuPtDgC5gnjxk2GOkjq6fivFTVTAY/1MhEJ42Zb9QE=; b=1ViKiCJyIqZaEKjKHCCAwpxs241BupF9vEz9QcYJK09xuNl6bc/S5uDiUOxmyr/53w vN2xalqgSawkfjYuQ4OQtKtwOAOOEFGw6c6gcv1hFJpeo/visDs5qCETWNwirKUn5yOp BkijEmQxAVFVUtUQwOFEVkb8lAsTGVqmD9omBNdbDWfHuj2ayfWQQtu2qCorTlKNIKmp 7noHSKWho9kRim45cZKXjn7L+lUsMgVc2VMjFG0zVct18cXOnYWkW/C4SeYW9n0B7gD6 C9+X8dLqinpIcBoUTunQdmPqlnztPYhugKAVbBaGx+7ASGtHy0+eOPjYoBDqk8Dk/V86 SpvQ== X-Gm-Message-State: ACrzQf12Zw4/OHMBhVTlBinSloESIdRYNjcTTxz1j4xWjOLoCprQTHMq gIPLCiVm+3jBWu3P7Piohwz1zdDya52kJ0mIIaG4DYnL3coAwUpHiXcKJjbVwpDogyn46ejlXT3 8UvDwH/WIzAivuHtq/7VX79G5yUdiTfsHigQu0WL+aNgHUDktTjDsgKFTwe/gaJcAaYVT X-Received: by 2002:a05:6000:170a:b0:22e:bd9c:2630 with SMTP id n10-20020a056000170a00b0022ebd9c2630mr10148521wrc.655.1665403159221; Mon, 10 Oct 2022 04:59:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NUJO2tbpMfeydo+BeNWE1to3cBvJrgWkhHp+FGPlqtyHR+ph9MPI03r7Ri8clO0nyncefhQ== X-Received: by 2002:a05:6000:170a:b0:22e:bd9c:2630 with SMTP id n10-20020a056000170a00b0022ebd9c2630mr10148495wrc.655.1665403158702; Mon, 10 Oct 2022 04:59:18 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id ay34-20020a05600c1e2200b003b4de550e34sm3842542wmb.40.2022.10.10.04.59.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 04:59:18 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id CBE12581C53; Mon, 10 Oct 2022 13:59:17 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Properly indent overload of equals() for class_decl Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Mon, 10 Oct 2022 13:59:17 +0200 Message-ID: <87lepn28kq.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=-12.2 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, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 looking at something else, I noticed that half of the overload of equals() for class_decl wasn't properly indented. Grrr. Fixed thus. * src/abg-ir.cc (equals): Fix indentation. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 212 +++++++++++++++++++++++++------------------------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 2fc7e747..51d1d550 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -23826,129 +23826,129 @@ equals(const class_decl& l, const class_decl& r, change_kind* k) #define RETURN(value) return return_comparison_result(l, r, value); // Compare bases. - if (l.get_base_specifiers().size() != r.get_base_specifiers().size()) + if (l.get_base_specifiers().size() != r.get_base_specifiers().size()) + { + result = false; + if (k) + *k |= LOCAL_TYPE_CHANGE_KIND; + else + RETURN(result); + } + + for (class_decl::base_specs::const_iterator + b0 = l.get_base_specifiers().begin(), + b1 = r.get_base_specifiers().begin(); + (b0 != l.get_base_specifiers().end() + && b1 != r.get_base_specifiers().end()); + ++b0, ++b1) + if (*b0 != *b1) { result = false; if (k) - *k |= LOCAL_TYPE_CHANGE_KIND; - else - RETURN(result); + { + if (!types_have_similar_structure((*b0)->get_base_class().get(), + (*b1)->get_base_class().get())) + *k |= LOCAL_TYPE_CHANGE_KIND; + else + *k |= SUBTYPE_CHANGE_KIND; + break; + } + RETURN(result); } - for (class_decl::base_specs::const_iterator - b0 = l.get_base_specifiers().begin(), - b1 = r.get_base_specifiers().begin(); - (b0 != l.get_base_specifiers().end() - && b1 != r.get_base_specifiers().end()); - ++b0, ++b1) - if (*b0 != *b1) + // Compare virtual member functions + + // We look at the map that associates a given vtable offset to a + // vector of virtual member functions that point to that offset. + // + // This is because there are cases where several functions can + // point to the same virtual table offset. + // + // This is usually the case for virtual destructors. Even though + // there can be only one virtual destructor declared in source + // code, there are actually potentially up to three generated + // functions for that destructor. Some of these generated + // functions can be clones of other functions that are among those + // generated ones. In any cases, they all have the same + // properties, including the vtable offset property. + + // So, there should be the same number of different vtable + // offsets, the size of two maps must be equals. + if (l.get_virtual_mem_fns_map().size() + != r.get_virtual_mem_fns_map().size()) + { + result = false; + if (k) + *k |= LOCAL_NON_TYPE_CHANGE_KIND; + else + RETURN(result); + } + + // Then, each virtual member function of a given vtable offset in + // the first class type, must match an equivalent virtual member + // function of a the same vtable offset in the second class type. + // + // By "match", I mean that the two virtual member function should + // be equal if we don't take into account their symbol name or + // their linkage name. This is because two destructor functions + // clones (for instance) might have different linkage name, but + // are still equivalent if their other properties are the same. + for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry = + l.get_virtual_mem_fns_map().begin(); + first_v_fn_entry != l.get_virtual_mem_fns_map().end(); + ++first_v_fn_entry) + { + unsigned voffset = first_v_fn_entry->first; + const class_decl::member_functions& first_vfns = + first_v_fn_entry->second; + + const class_decl::virtual_mem_fn_map_type::const_iterator + second_v_fn_entry = r.get_virtual_mem_fns_map().find(voffset); + + if (second_v_fn_entry == r.get_virtual_mem_fns_map().end()) { result = false; if (k) - { - if (!types_have_similar_structure((*b0)->get_base_class().get(), - (*b1)->get_base_class().get())) - *k |= LOCAL_TYPE_CHANGE_KIND; - else - *k |= SUBTYPE_CHANGE_KIND; - break; - } + *k |= LOCAL_NON_TYPE_CHANGE_KIND; RETURN(result); } - // Compare virtual member functions + const class_decl::member_functions& second_vfns = + second_v_fn_entry->second; - // We look at the map that associates a given vtable offset to a - // vector of virtual member functions that point to that offset. - // - // This is because there are cases where several functions can - // point to the same virtual table offset. - // - // This is usually the case for virtual destructors. Even though - // there can be only one virtual destructor declared in source - // code, there are actually potentially up to three generated - // functions for that destructor. Some of these generated - // functions can be clones of other functions that are among those - // generated ones. In any cases, they all have the same - // properties, including the vtable offset property. - - // So, there should be the same number of different vtable - // offsets, the size of two maps must be equals. - if (l.get_virtual_mem_fns_map().size() - != r.get_virtual_mem_fns_map().size()) - { - result = false; - if (k) - *k |= LOCAL_NON_TYPE_CHANGE_KIND; - else - RETURN(result); - } - - // Then, each virtual member function of a given vtable offset in - // the first class type, must match an equivalent virtual member - // function of a the same vtable offset in the second class type. - // - // By "match", I mean that the two virtual member function should - // be equal if we don't take into account their symbol name or - // their linkage name. This is because two destructor functions - // clones (for instance) might have different linkage name, but - // are still equivalent if their other properties are the same. - for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry = - l.get_virtual_mem_fns_map().begin(); - first_v_fn_entry != l.get_virtual_mem_fns_map().end(); - ++first_v_fn_entry) - { - unsigned voffset = first_v_fn_entry->first; - const class_decl::member_functions& first_vfns = - first_v_fn_entry->second; - - const class_decl::virtual_mem_fn_map_type::const_iterator - second_v_fn_entry = r.get_virtual_mem_fns_map().find(voffset); - - if (second_v_fn_entry == r.get_virtual_mem_fns_map().end()) + bool matches = false; + for (class_decl::member_functions::const_iterator i = + first_vfns.begin(); + i != first_vfns.end(); + ++i) + if (method_matches_at_least_one_in_vector(*i, second_vfns)) { - result = false; - if (k) - *k |= LOCAL_NON_TYPE_CHANGE_KIND; - RETURN(result); + matches = true; + break; } - const class_decl::member_functions& second_vfns = - second_v_fn_entry->second; - - bool matches = false; - for (class_decl::member_functions::const_iterator i = - first_vfns.begin(); - i != first_vfns.end(); - ++i) - if (method_matches_at_least_one_in_vector(*i, second_vfns)) - { - matches = true; - break; - } - - if (!matches) - { - result = false; - if (k) - *k |= SUBTYPE_CHANGE_KIND; - else - RETURN(result); - } - } + if (!matches) + { + result = false; + if (k) + *k |= SUBTYPE_CHANGE_KIND; + else + RETURN(result); + } + } - // We are done comparing these two types and we have a full - // understanding of how they might be different, if they are. Let's - // cache the result of this comparison -- in case we are asked in a - // very near future to compare them again. - // - // TODO: If further profiling shows its necessity, maybe we should - // perform this caching also on the earlier return points of this - // function. That would basically mean to redefine the RETURN macro - // to make it perform this caching for us. - l.get_environment()->priv_->cache_type_comparison_result(l, r, result); + // We are done comparing these two types and we have a full + // understanding of how they might be different, if they are. Let's + // cache the result of this comparison -- in case we are asked in a + // very near future to compare them again. + // + // TODO: If further profiling shows its necessity, maybe we should + // perform this caching also on the earlier return points of this + // function. That would basically mean to redefine the RETURN macro + // to make it perform this caching for us. + l.get_environment()->priv_->cache_type_comparison_result(l, r, result); - RETURN(result); + RETURN(result); #undef RETURN }