From patchwork Tue Nov 24 10:21:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 41176 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 AA2243896829; Tue, 24 Nov 2020 10:21:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA2243896829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606213308; bh=fHthEdzA6wJCjGquKYaW1Bebym3pKeDKRnU2p4CKNRw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=nukuK3Lu42D8X2O6IOYRvclQazZYZoE9WRLqBY0pClwFrklTJnPAefcCzH7NtmueA pn1yG4CXblhqT2583n5coXV1ik7icBNOlytdAnW62CUMFqjo6fM5efUuinET34Z0lD Y+O0kXVF0IrlNThp2wBgMKhs3Cq06oL3L/Uoe31Y= 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 [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 0DC333854834 for ; Tue, 24 Nov 2020 10:21:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0DC333854834 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-lXOzKPWRP6SCmIKnAsr7LA-1; Tue, 24 Nov 2020 05:21:43 -0500 X-MC-Unique: lXOzKPWRP6SCmIKnAsr7LA-1 Received: by mail-wm1-f72.google.com with SMTP id y26so704967wmj.7 for ; Tue, 24 Nov 2020 02:21:43 -0800 (PST) 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:qorganization:date:message-id :user-agent:mime-version; bh=fHthEdzA6wJCjGquKYaW1Bebym3pKeDKRnU2p4CKNRw=; b=V7aeficwm9EQEpMw0jK1D561wfpv+I3Xlw6OFJSH88fd4CWT6EoonmeHltRG/u8HDK O9fN7VTNpgcNKBEyDBDoTBh/Fa4UzF7rzFmoULT6VctV9zpYhZmyovHoCQopclOtgsx+ YaJjliiqu1GXn4qI5i5zuTnIn1wRBTZRv4dJKk2ZjS/xA5ksNBYnrOmFqw+OTuO086kB hHpaIKV1pp2rM1kCwAPNHmQLsIGrG5yfHNKep7prN6U1Gw5fNc7ezJHq1nsa4m0dP5Hn 1NURtVg200xfRpDV4FcN0kPv0svn2Sf1cEDWoKSEtyGStiNFqWTivcIqBse+Izm+mzcV 2F2Q== X-Gm-Message-State: AOAM532hWNgOdbL6vqQnMC0+a719f369TC5Nz5+/VI7UVXg4VqaUYbEM LxTvTeQ2+9OyO74Gh70ByBud4P7cuQAIHsHl5U3AirOWqube6WP4G46U959t36vza4vEQloBLnQ xuK4+yV1uydgumKHl+ELWijNyV0GQxLLOLeM/6+1uzCt0vMt1E7Nrf0aegxWOek7KezCZ X-Received: by 2002:a1c:21c1:: with SMTP id h184mr3722272wmh.106.1606213302314; Tue, 24 Nov 2020 02:21:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQTYXKdibsbtJhtoPaqj0lLC6Jx0XZ8aGEp3p7Ghg6LuNJ/ChgZnMuwg8LcbutOvvYCNsZEA== X-Received: by 2002:a1c:21c1:: with SMTP id h184mr3722244wmh.106.1606213301961; Tue, 24 Nov 2020 02:21:41 -0800 (PST) Received: from localhost (91-166-131-65.subs.proxad.net. [91.166.131.65]) by smtp.gmail.com with ESMTPSA id d3sm24275728wre.91.2020.11.24.02.21.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2020 02:21:41 -0800 (PST) Received: by localhost (Postfix, from userid 1001) id 3FAE01A111B; Tue, 24 Nov 2020 11:21:40 +0100 (CET) To: libabigail@sourceware.org Subject: [PATCH] ir: Add equality op to array_type_def::subrange_type::bound_value X-Operating-System: Red Hat Enterprise Linux Server 7.8 X-URL: http://www.redhat.com qOrganization: Red Hat / France Date: Tue, 24 Nov 2020 11:21:40 +0100 Message-ID: <868sarrr63.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.3 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_NONE, 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@sourceware.org Sender: "Libabigail" Hello, I noticed that array_type_def::subrange_type::bound_value didn't have an equality operator. Having one is useful in setting debugger breakpoints to detect when bound values are being compared and analyse why. This patch adds that operator. * include/abg-ir.h (array_type_def::subrange_type::bound_value::operator==): Declare new ... * src/abg-ir.cc (array_type_def::subrange_type::bound_value::operator==): ... equality operator. Signed-off-by: Dodji Seketeli Applied to master. --- include/abg-ir.h | 1 + src/abg-ir.cc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/abg-ir.h b/include/abg-ir.h index 9ca083c..dca0d12 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -2326,6 +2326,7 @@ public: uint64_t get_unsigned_value(); void set_unsigned(uint64_t v); void set_signed(int64_t v); + bool operator==(const bound_value&) const; }; //end class bound_value /// Hasher for an instance of array::subrange diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 516e34b..a78889a 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -14738,6 +14738,17 @@ array_type_def::subrange_type::bound_value::set_signed(int64_t v) v_.signed_ = v; } +/// Equality operator of the bound value. +/// +/// @param v the other bound value to compare with. +/// +/// @return true iff the current bound value equals @p v. +bool +array_type_def::subrange_type::bound_value::operator==(const bound_value& v) const +{ + return s_ == v.s_ && v_.unsigned_ == v.v_.unsigned_; +} + // struct array_type_def::subrange_type::priv