From patchwork Tue May 25 10:07:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 43563 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 342713896C13; Tue, 25 May 2021 10:08:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 342713896C13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621937289; bh=b097XisAjyaVH4aK9FDjUbPzBcfUYjX6L4YPpjIiJ84=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=QfKynzJ7zKs/vSJOgn9KcVs1nV0rrA0xVr9hYYlWCzdVxz9fkc26B7bqOPEwmaWo5 B1m4N9jN5aAV0XzUjF+LSgTEBHKsFvg56EAp13LGz6iHwJHAuZ3emUdzrpWjyWxKC+ isqKcVMS3563Le6QG2EzaGCVls+03BQ3syRc92QU= 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 ECD653896C0A for ; Tue, 25 May 2021 10:08:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ECD653896C0A Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-420-Iy15hlHMON64jg5Mo_KXdQ-1; Tue, 25 May 2021 06:08:02 -0400 X-MC-Unique: Iy15hlHMON64jg5Mo_KXdQ-1 Received: by mail-wr1-f70.google.com with SMTP id c13-20020a5d6ccd0000b029010ec741b84bso14345257wrc.23 for ; Tue, 25 May 2021 03:07:59 -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=b097XisAjyaVH4aK9FDjUbPzBcfUYjX6L4YPpjIiJ84=; b=ckjh6ZyNoztN1IPRQ1DItpAPs13UqrltFu+m3UAX4h3Fsq+noaA0wMBHJyQpkcp9/8 7EUgReD+GMvJpLTgALD0uE2tTYq33UmRhgCbwa4tOhiL3zNguztGnjD6SjTplFsn6PZt CJj/GobQHQ/VwvSeeDWQEojrWc8swnNF9vknr7C5JRlV69jLGG25512IGEblzSHcYOXO O9DI1DxBmOML5+lS7xGMXF0uZbDSDa1O7DOyKDm8vuqnTazB3s1+tS25E4Lx1Nsh88Qr 7quEqBeEDQbXh/xemxzmFIV4u8Km5AzOhf+N8l7QDtsI1qtbdTHDky3CbXbJMns5BP+u z5mA== X-Gm-Message-State: AOAM533HLi7b85vCD1OMDBaHawaUjqB5EA0/ZlnEcC+nRyIetYs88s0M 8u/2lHXdKVzrc0PrdBpfRHeiSf7RpsRRdqDzLCa6UfAxsHvzFcKmr4+tmGMg2HNJkFOTVVSswwA hhcoN4JetnJ3gbzO+kKw47V5yKcPH1MRL9fr4T3/rS4GBH0dzDDa4esUmRVaeAzunwi4e X-Received: by 2002:a1c:4444:: with SMTP id r65mr3015549wma.127.1621937276778; Tue, 25 May 2021 03:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHsR2djKID9YgAcPiLXyq4XQj45o2JLvo94kYoU2LjPpAMn6tx1c5dVeNYqwJeugtTqWhSVg== X-Received: by 2002:a1c:4444:: with SMTP id r65mr3015526wma.127.1621937276441; Tue, 25 May 2021 03:07:56 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id l8sm15530035wrw.71.2021.05.25.03.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 03:07:55 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id C788F58000E; Tue, 25 May 2021 12:07:54 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] Peel array types when peeling pointers from a type Organization: Red Hat / France X-Operating-System: Fedora 35 X-URL: http://www.redhat.com Date: Tue, 25 May 2021 12:07:54 +0200 Message-ID: <874ker5dol.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_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@sourceware.org Sender: "Libabigail" Hello, In peel_typedef_pointer_or_reference_type, we want to peel typedefs and pointer types (in general) from a given type. We need to peel array types as well, as those are conceptually a pointer-like type as well. This patch does that. * src/abg-ir.cc (peel_typedef_pointer_or_reference_type): In the overloads for type_base_sptr and type_base*, peel array type off as well. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 85766edf..d0f8c6b8 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -6073,7 +6073,8 @@ peel_typedef_pointer_or_reference_type(const type_base_sptr type) type_base_sptr typ = type; while (is_typedef(typ) || is_pointer_type(typ) - || is_reference_type(typ)) + || is_reference_type(typ) + || is_array_type(typ)) { if (typedef_decl_sptr t = is_typedef(typ)) typ = peel_typedef_type(t); @@ -6083,6 +6084,9 @@ peel_typedef_pointer_or_reference_type(const type_base_sptr type) if (reference_type_def_sptr t = is_reference_type(typ)) typ = peel_reference_type(t); + + if (const array_type_def_sptr t = is_array_type(typ)) + typ = peel_array_type(t); } return typ; @@ -6100,7 +6104,8 @@ peel_typedef_pointer_or_reference_type(const type_base* type) { while (is_typedef(type) || is_pointer_type(type) - || is_reference_type(type)) + || is_reference_type(type) + || is_array_type(type)) { if (const typedef_decl* t = is_typedef(type)) type = peel_typedef_type(t); @@ -6110,6 +6115,9 @@ peel_typedef_pointer_or_reference_type(const type_base* type) if (const reference_type_def* t = is_reference_type(type)) type = peel_reference_type(t); + + if (const array_type_def* t = is_array_type(type)) + type = peel_array_type(t); } return const_cast(type); @@ -6130,6 +6138,7 @@ peel_pointer_or_reference_type(const type_base *type, { while (is_pointer_type(type) || is_reference_type(type) + || is_array_type(type) || (peel_qual_type && is_qualified_type(type))) { if (const pointer_type_def* t = is_pointer_type(type))