From patchwork Tue Feb 21 15:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 65452 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 1EFC13858C39 for ; Wed, 22 Feb 2023 11:08:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EFC13858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677064133; bh=7Rrrmu5nQ7I5ZqAxVQ03Fe2rYgnlfcpRZWC3m1bHMfQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=vZkwq2GYUdLjEUz8TNLEXS5niQlaE6cPu6sFbsDWV7+YEkMIs4gQ5tBdLZCl26X+o /5mjep+QLDF2dMNrfZSm28OSw/sKZWEYqP7koFkM+qf+yZiZnD34ZvaGXvQ3vbsNUX nGAcb8fYwDxafvMRNgkSg09V1dcbCxW+oGJgcSGQ= 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 3EB053858C83 for ; Wed, 22 Feb 2023 11:08:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3EB053858C83 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-53-vX3AvZH9Ng2hlYQlW2qikA-1; Wed, 22 Feb 2023 06:08:42 -0500 X-MC-Unique: vX3AvZH9Ng2hlYQlW2qikA-1 Received: by mail-qk1-f197.google.com with SMTP id q12-20020a05620a0c8c00b0072fcbe20069so4420877qki.22 for ; Wed, 22 Feb 2023 03:08:42 -0800 (PST) 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=7Rrrmu5nQ7I5ZqAxVQ03Fe2rYgnlfcpRZWC3m1bHMfQ=; b=yBiXD2+cBPBahCqTlDCDFusocsdiyjp7m4RFTp7pGFwR9cV5jmaT6op1jqaU9Okq0A pCXh0/QYWjnspUAUrjP8Gc7apcioUdTfAwYt6NadkukbltIUvyBinj7v2q4+3NeScDnc JjOU8c+9G5DOH1R3J5OB/xPkhtvUSP/W98qWCypw/QAjT4PByTR7Z8j3Ck4R6dut4Jal nCYpbLnm+iG3M5lLgybl2k+JtPH6mhAg1ZHZbwqEAAVF/2j1Rw4VMvhmhTWra1m/I0c6 Duslr7x6Z6mtASQNIwfMHCkhQKNilny52+G0/uW6nf3u1q7T2LALZiBtefJ8n3+rnDcU Wl7A== X-Gm-Message-State: AO0yUKWX1zG41PI6LdorcxiQymP0B70cjCap5B7BIWZO6uhZ5IwhVgDl PX3tIZrW50Fz0+3CQEAQg5fxgbWWJN8eI05F8keUYYz1IRjb1XM6rdp2XHYsHqfib6mxZ/4JVkE iT4nv4fjx8uNRQR0tZHmrr85TzB0G8fdYOCZBmZSveWivqwkyX2ngdz5YYRvZdyGGDXV3UuiAiQ == X-Received: by 2002:ac8:7f47:0:b0:3b6:359f:39e5 with SMTP id g7-20020ac87f47000000b003b6359f39e5mr12919867qtk.49.1677064121609; Wed, 22 Feb 2023 03:08:41 -0800 (PST) X-Google-Smtp-Source: AK7set/C3rvgj5tGdHNabX1xI5oENHLEZWikvB3Ol51doaZMh3xf64RfO3l/TxkgdjFo/nCOMAbLng== X-Received: by 2002:ac8:7f47:0:b0:3b6:359f:39e5 with SMTP id g7-20020ac87f47000000b003b6359f39e5mr12919810qtk.49.1677064121094; Wed, 22 Feb 2023 03:08:41 -0800 (PST) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id y20-20020ac87054000000b003b86d5c4fbbsm2803843qtm.1.2023.02.22.03.08.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 03:08:40 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id D1072581F75; Tue, 21 Feb 2023 16:38:29 +0100 (CET) To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Add missing virtual methods overloads Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Tue, 21 Feb 2023 16:38:28 +0100 Message-ID: <875ybvt4ej.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.7 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_H2, 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, Fedora Rawhide recently moved to GCC 13 and so its emitting new warnings about libabigail's code base, and rightly so. This patch thus adds some missing virtual method overloads that are spotted by GCC 13. * include/abg-ir.h (type_decl::operator!=): Declare missing virtual overloads. (array_type_def::subrange_type::operator!=): Likewise. (template_decl::operator==): Likewise. (type_tparameter::operator==): Likewise. (class_decl::operator==): Likewise. (union_decl::operator==): Likewise. (member_class_template::operator==): Likewise. * src/abg-ir.cc (type_decl::operator!=) (array_type_def::subrange_type::operator!=) (class_decl::operator==, member_class_template::operator==) (union_decl::operator==, template_decl::operator==) (type_tparameter::operator==, type_tparameter::operator==) (template_tparameter::operator==): Define new virtual overloads. Signed-off-by: Dodji Seketeli Applied to master. --- include/abg-ir.h | 36 +++++++++- src/abg-ir.cc | 176 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+), 1 deletion(-) diff --git a/include/abg-ir.h b/include/abg-ir.h index 6f83cfb0..0ca8afcf 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -2094,7 +2094,14 @@ public: virtual bool operator==(const type_decl&) const; - bool operator!=(const type_decl&)const; + virtual bool + operator!=(const type_base&)const; + + virtual bool + operator!=(const decl_base&)const; + + virtual bool + operator!=(const type_decl&)const; virtual void get_qualified_name(interned_string& qualified_name, @@ -2554,6 +2561,12 @@ public: bool operator==(const subrange_type& o) const; + bool + operator!=(const decl_base& o) const; + + bool + operator!=(const type_base& o) const; + bool operator!=(const subrange_type& o) const; @@ -3438,6 +3451,9 @@ public: const std::list& get_template_parameters() const; + virtual bool + operator==(const decl_base& o) const; + virtual bool operator==(const template_decl& o) const; @@ -3514,6 +3530,12 @@ public: virtual bool operator==(const type_base&) const; + virtual bool + operator==(const type_decl&) const; + + virtual bool + operator==(const decl_base&) const; + virtual bool operator==(const template_parameter&) const; @@ -3592,6 +3614,9 @@ public: virtual bool operator==(const type_base&) const; + virtual bool + operator==(const decl_base&) const; + virtual bool operator==(const template_parameter&) const; @@ -4212,6 +4237,9 @@ public: virtual bool operator==(const type_base&) const; + virtual bool + operator==(const class_or_union&) const; + virtual bool operator==(const class_decl&) const; @@ -4383,6 +4411,9 @@ public: virtual bool operator==(const type_base&) const; + virtual bool + operator==(const class_or_union&) const; + virtual bool operator==(const union_decl&) const; @@ -4642,6 +4673,9 @@ public: virtual bool operator==(const member_base& o) const; + virtual bool + operator==(const decl_base&) const; + virtual bool operator==(const member_class_template&) const; diff --git a/src/abg-ir.cc b/src/abg-ir.cc index ff7573ea..321adbf5 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -15295,6 +15295,28 @@ type_decl::operator==(const type_decl& o) const return *this == other; } +/// Return true if both types equals. +/// +/// Note that this does not check the scopes of any of the types. +/// +/// @param o the other type_decl to check against. +/// +/// @return true iff the current isntance equals @p o +bool +type_decl::operator!=(const type_base&o)const +{return !operator==(o);} + +/// Return true if both types equals. +/// +/// Note that this does not check the scopes of any of the types. +/// +/// @param o the other type_decl to check against. +/// +/// @return true iff the current isntance equals @p o +bool +type_decl::operator!=(const decl_base&o)const +{return !operator==(o);} + /// Inequality operator. /// /// @param o the other type to compare against. @@ -17376,6 +17398,26 @@ array_type_def::subrange_type::operator==(const subrange_type& o) const return operator==(t); } +/// Equality operator. +/// +/// @param o the other subrange to test against. +/// +/// @return true iff @p o equals the current instance of +/// array_type_def::subrange_type. +bool +array_type_def::subrange_type::operator!=(const decl_base& o) const +{return !operator==(o);} + +/// Equality operator. +/// +/// @param o the other subrange to test against. +/// +/// @return true iff @p o equals the current instance of +/// array_type_def::subrange_type. +bool +array_type_def::subrange_type::operator!=(const type_base& o) const +{return !operator==(o);} + /// Inequality operator. /// /// @param o the other subrange to test against. @@ -23887,6 +23929,20 @@ class_decl::operator==(const type_base& other) const return *this == *o; } +/// Equality operator for class_decl. +/// +/// Re-uses the equality operator that takes a decl_base. +/// +/// @param other the other class_decl to compare against. +/// +/// @return true iff the current instance equals the other one. +bool +class_decl::operator==(const class_or_union& other) const +{ + const decl_base& o = other; + return *this == o; +} + /// Comparison operator for @ref class_decl. /// /// @param other the instance of @ref class_decl to compare against. @@ -24240,6 +24296,19 @@ member_class_template::operator==(const member_base& other) const {return false;} } +/// Equality operator of the the @ref member_class_template class. +/// +/// @param other the other @ref member_class_template to compare against. +/// +/// @return true iff the current instance equals @p other. +bool +member_class_template::operator==(const decl_base& other) const +{ + if (!decl_base::operator==(other)) + return false; + return as_class_tdecl()->class_tdecl::operator==(other); +} + /// Comparison operator for the @ref member_class_template /// type. /// @@ -24680,6 +24749,20 @@ union_decl::operator==(const type_base& other) const return *this == *o; } +/// Equality operator for union_decl. +/// +/// Re-uses the equality operator that takes a decl_base. +/// +/// @param other the other union_decl to compare against. +/// +/// @return true iff the current instance equals the other one. +bool +union_decl::operator==(const class_or_union&other) const +{ + const decl_base *o = dynamic_cast(&other); + return *this == *o; +} + /// Comparison operator for @ref union_decl. /// /// @param other the instance of @ref union_decl to compare against. @@ -24937,6 +25020,20 @@ template_decl::template_decl(const environment& env, template_decl::~template_decl() {} +/// Equality operator. +/// +/// @param o the other instance to compare against. +/// +/// @return true iff @p equals the current instance. +bool +template_decl::operator==(const decl_base& o) const +{ + const template_decl* other = dynamic_cast(&o); + if (!other) + return false; + return *this == *other; +} + /// Equality operator. /// /// @param o the other instance to compare against. @@ -25092,6 +25189,11 @@ type_tparameter::type_tparameter(unsigned index, runtime_type_instance(this); } +/// Equality operator. +/// +/// @param other the other template type parameter to compare against. +/// +/// @return true iff @p other equals the current instance. bool type_tparameter::operator==(const type_base& other) const { @@ -25107,6 +25209,51 @@ type_tparameter::operator==(const type_base& other) const {return false;} } +/// Equality operator. +/// +/// @param other the other template type parameter to compare against. +/// +/// @return true iff @p other equals the current instance. +bool +type_tparameter::operator==(const type_decl& other) const +{ + if (!type_decl::operator==(other)) + return false; + + try + { + const type_tparameter& o = dynamic_cast(other); + return template_parameter::operator==(o); + } + catch (...) + {return false;} +} + +/// Equality operator. +/// +/// @param other the other template type parameter to compare against. +/// +/// @return true iff @p other equals the current instance. +bool +type_tparameter::operator==(const decl_base& other) const +{ + if (!decl_base::operator==(other)) + return false; + + try + { + const type_tparameter& o = dynamic_cast(other); + return template_parameter::operator==(o); + } + catch (...) + {return false;} +} + +/// Equality operator. +/// +/// @param other the other template type parameter to compare against. +/// +/// @return true iff @p other equals the current instance. bool type_tparameter::operator==(const template_parameter& other) const { @@ -25119,6 +25266,11 @@ type_tparameter::operator==(const template_parameter& other) const {return false;} } +/// Equality operator. +/// +/// @param other the other template type parameter to compare against. +/// +/// @return true iff @p other equals the current instance. bool type_tparameter::operator==(const type_tparameter& other) const {return *this == static_cast(other);} @@ -25253,6 +25405,11 @@ template_tparameter::template_tparameter(unsigned index, runtime_type_instance(this); } +/// Equality operator. +/// +/// @param other the other template parameter to compare against. +/// +/// @return true iff @p other equals the current instance. bool template_tparameter::operator==(const type_base& other) const { @@ -25267,6 +25424,25 @@ template_tparameter::operator==(const type_base& other) const {return false;} } +/// Equality operator. +/// +/// @param other the other template parameter to compare against. +/// +/// @return true iff @p other equals the current instance. +bool +template_tparameter::operator==(const decl_base& other) const +{ + try + { + const template_tparameter& o = + dynamic_cast(other); + return (type_tparameter::operator==(o) + && template_decl::operator==(o)); + } + catch(...) + {return false;} +} + bool template_tparameter::operator==(const template_parameter& o) const {