From patchwork Thu Aug 29 16:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 96720 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 A2E1D3860C37 for ; Thu, 29 Aug 2024 16:06:20 +0000 (GMT) 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 ESMTP id D15D9385B50D for ; Thu, 29 Aug 2024 16:06:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D15D9385B50D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D15D9385B50D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724947576; cv=none; b=muDINK5WFf3hOroEssK9e++GUKics+4Zi88byGexsdDeh6PJGic7+FDEmxUfZDLuLc9sucjFOu0j/rKgpDy1YIP4UTqXRP3EoFvoItBkID/mEUGmO7qfgfqQM0OCGzfnLh+jGxm1XgrInzSMZ160wjjFv0YJV8Q/mm0RwKrLer8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724947576; c=relaxed/simple; bh=VDW8K79A2MLx2cR/FragMeeJ6tn0FXkztAgEhxw0UFM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xr7fuzlmkv/yzvCD96xC8y5l6PpSjkle4BPd4Bx7gSrDOx+iK0gITHEuX5Zd6T0+jTadVsMB4eJwCvRtyl8fxOZJe9RPAGP30scgx2b0Clq8VKMV8YqxBq2A/e7Cy79jF4wQiccMny7oOYSscuNpG32vnue+LY01GUmuBwnJpk8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724947574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ekyyYSmvELj0mu+XHsxgPEEqFI+C70KbOsXGvl9vMG4=; b=U/m0Ac2oOQ1y71ka5dHCH86MgAxt4X3R5MTGY3b1Oz5FRVVyPLzGt4/MrU1Or8A++gEc7C E8XdptUO09Ipn2zv5tdqe3lvJcCQJJFcv6RhxBg19pgyNMhUPhmg4z2pTACqkPcvG+ouBs 0xG07PfnplC+/OCPkzWj4pCh8CBK3KE= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-HTkq0ry3Nvmyy8ULSbS6cA-1; Thu, 29 Aug 2024 12:06:13 -0400 X-MC-Unique: HTkq0ry3Nvmyy8ULSbS6cA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6bf6bdb14baso11243286d6.3 for ; Thu, 29 Aug 2024 09:06:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724947572; x=1725552372; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekyyYSmvELj0mu+XHsxgPEEqFI+C70KbOsXGvl9vMG4=; b=ayIDIng1yeviVVbr017jqy9xzQe97i1Yayv3k7C3F3+oCCIbS18oL0pXnVJ1xDTndp azqk5g7i50yVXWaEXTZDfR4IB0qI/oMd9YQ3hzZGk6EpbcabqeoFHZw1DHroN5Ww7U2W o89KeCt+fhMIVYQ9nvvt4LbwhjohkG9VYvC2RqK+w95AUpQ7y6SoJBPW4bAjRTA1pgjm Ar1K4DZ3e8qlSS0WwX+HAMYkoLXYzNRPMjLKe2SAXUHEOrDXWjsWvG2Y8LKRFZBTTFhD AHbhmBxxOCQdXGW7Nk2mH6avor7dboVi4Z5hTJiwGRxNhcmI4ZWdK5+J/LN4rBie7z8B 8E/w== X-Gm-Message-State: AOJu0YxMlbwHDfLeT62qh3Vv52hQZ9YAWHskR8pgzMggkFghVxjNIWWN CSAN3Ba+ZPtAvJyPJ838IbvyJSQeyQvGRICDQmQTBlyvk+s0I7fn8qyF95Ur2fFlLAdye4AZPFs WsdP5ruSvoE8miwqBV1wpmbpeMUJxkAjwRraGiGrl/+eRE7YHPF6ru6a2XlwP53uzsA== X-Received: by 2002:a05:6214:3982:b0:6b5:eba0:d0ab with SMTP id 6a1803df08f44-6c33e616300mr35773256d6.15.1724947572232; Thu, 29 Aug 2024 09:06:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcIbR+xSLxUcPZ3pPNYriF4BfATrWaA8WqM1z/2tDG9xJCVnAthg9BTOrjShhQghvIKqbQVA== X-Received: by 2002:a05:6214:3982:b0:6b5:eba0:d0ab with SMTP id 6a1803df08f44-6c33e616300mr35772876d6.15.1724947571820; Thu, 29 Aug 2024 09:06:11 -0700 (PDT) Received: from localhost (88-120-130-27.subs.proxad.net. [88.120.130.27]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c340c967d8sm6358256d6.91.2024.08.29.09.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 09:06:11 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id F281D503C602; Thu, 29 Aug 2024 18:06:09 +0200 (CEST) From: Dodji Seketeli To: dodji@redhat.com Cc: libabigail@sourceware.org Subject: [PATCH 17/27] dwarf-reader: Fix building of void, void* and variadic parm types Organization: Me, myself and I References: <20240829154711.1883174-1-dodji@redhat.com> X-Operating-System: AlmaLinux 9.4 X-URL: http://www.seketeli.net/~dodji Date: Thu, 29 Aug 2024 18:06:09 +0200 In-Reply-To: <20240829154711.1883174-1-dodji@redhat.com> (dodji@redhat.com's message of "Thu, 29 Aug 2024 17:46:29 +0200") Message-ID: <878qwfl3f2.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 Hello, This patch adds the IR nodes of void, void* and variadic parm types to their scope just once. Also, it schedules them for (sorting, hashing and) canonicalization just like other types. * src/abg-dwarf-reader.cc (build_ir_node_for_void_type) (build_ir_node_for_void_pointer_type) (build_ir_node_for_variadic_parameter_type): Add the type node to its scope just once. Use reader::schedule_type_for_late_canonicalization to canonicalize it. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 253e647d..bf33dc7c 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -17158,9 +17158,12 @@ build_ir_node_for_void_type(reader& rdr) const environment& env = rdr.env(); type_base_sptr t = env.get_void_type(); - add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); decl_base_sptr type_declaration = get_type_declaration(t); - canonicalize(t); + if (!has_scope(type_declaration)) + { + add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); + rdr.schedule_type_for_late_canonicalization(t); + } return type_declaration; } @@ -17179,11 +17182,13 @@ static type_or_decl_base_sptr build_ir_node_for_void_pointer_type(reader& rdr) { const environment& env = rdr.env(); - type_base_sptr t = env.get_void_pointer_type(); - add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); decl_base_sptr type_declaration = get_type_declaration(t); - canonicalize(t); + if (!has_scope(type_declaration)) + { + add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); + rdr.schedule_type_for_late_canonicalization(t); + } return type_declaration; } @@ -17197,11 +17202,13 @@ build_ir_node_for_variadic_parameter_type(reader &rdr) { const environment& env = rdr.env(); - type_base_sptr t = env.get_variadic_parameter_type(); - add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); decl_base_sptr type_declaration = get_type_declaration(t); - canonicalize(t); + if (!has_scope(type_declaration)) + { + add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope()); + rdr.schedule_type_for_late_canonicalization(t); + } return type_declaration; }