From patchwork Wed Aug 14 12:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95821 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 CB0EA3858C60 for ; Wed, 14 Aug 2024 12:57:26 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by sourceware.org (Postfix) with ESMTPS id 9E3CE3858C50 for ; Wed, 14 Aug 2024 12:56:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E3CE3858C50 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E3CE3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.199 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; cv=none; b=T4RDjKll6UZubR5ZZ4epSN3B3qe6CQdS11bOewamciQXAbFpaUGafWIoxBks+dGb10HOW7Brs5cdJSP4CfqKsYM3/eWXoAE/tIYsjzlK5vMqf2ZQqLucdat+3Z8ATVooSFt3eCzWZPGw+EtqK+m+woU21rcsNAg6GV9zGMB/YuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; c=relaxed/simple; bh=0V82D3RA4FgmnVJ3qnG2vUEyWpKzaOb1fWJ6p7nHhAc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eweLe6421mj7J2Yn7XqlTo1Qppf4sabWs/f+8tOVOvwJKA8a4+rneOn/2Guz6Zc9FPq/hzpuFk1TbauXSCgttfn2ToXCeesAmbkbJjLJnrwhhz/SD4o5nMP8OOr7XSQNfDXn5tPy0TkYHMgm/17nPYGMoUVxFuAbN4iAU2e+zP0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id BC5B1FF808; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 2F063507A62B; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 06/11] ir: Support comparing a class_decl against a class_or_union Date: Wed, 14 Aug 2024 14:56:44 +0200 Message-ID: <20240814125649.47119-6-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli When a class_decl is compared against a class_or_union type using class_decl::operator==, that operator systematically fails. This patch fixes that by comparing the common parts between the two objects. * src/abg-ir.cc (class_decl::operator==): Support comparing against a class_or_union. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index d0f267be..0b9e8d48 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -25647,7 +25647,11 @@ class_decl::operator==(const decl_base& other) const { const class_decl* op = is_class_type(&other); if (!op) - return false; + { + if (class_or_union* cou = is_class_or_union_type(&other)) + return class_or_union::operator==(*cou); + return false; + } // If this is a decl-only type (and thus with no canonical type), // use the canonical type of the definition, if any.