From patchwork Wed Jul 13 10:03:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1655934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=SlCIorEp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LjYCG1dCMz9ryY for ; Wed, 13 Jul 2022 20:05:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0367A384F001 for ; Wed, 13 Jul 2022 10:05:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0367A384F001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657706712; bh=pRfH39mZew8Mp9jeQEEp8Jf581083NpFbzygbPC4oFQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SlCIorEpjsFY4mSv4Mjc7NDaiJ1SWaOr0xH0RNWtPQfwIlWur7MWaTlf/PwKfB0Yi tEWzDhJ4snpz1ERmpfhYNGxC7mEWYPgW7mf6LmXcV9uh1nljj13asRpgtW67NtG9Li SVde+9KDWF5RHti8kW7ktNDfFfJaW+UUJVxqRB2M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 784003851AB0 for ; Wed, 13 Jul 2022 10:03:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 784003851AB0 Received: by mail-ed1-x534.google.com with SMTP id y8so13429628eda.3 for ; Wed, 13 Jul 2022 03:03:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=pRfH39mZew8Mp9jeQEEp8Jf581083NpFbzygbPC4oFQ=; b=rcNNL8sI0dzPfFtm5poEb7CNJs40AjeOuDpZUmkBVK+GpYcOG/43wmxNpuMW0m0oiI Mj83Blb2ro+6E5+A8qxHqjmxVS01zjkHh8TWxKIqlGYozmcHySQCrxKFNwnmWWGGFi2n Khn1rWNwRY7V1dL9kuriK1k7wzltxmtk9vhU9mJebvIsM1I/YwDfUL4jB7qf22elHEAs HSPeSAGP7DUi6r5HZ5/QQMGexEiDgS1GFQ7eM5Pf8VdFxCzwOFu81J1nUALn/nwTdhlM g6FxA6K6pBd9ft8PdkArCqYCQeI1OSweAMEUDYRUmrGtyhiEDLYM3xeqoPfoW+6cgh2t SP+g== X-Gm-Message-State: AJIora8fj4HE7krtHa51JyNw1RterfIPa3JPTGvkg/DqCN11n7JbOK6B vG6ggZys1E1TsKV8zFYNtR+4U7+xhhh14Q== X-Google-Smtp-Source: AGRyM1uDhQrQFpLAdVG/00xOUVBJpQQdB3+bFMO0Amtfq0lY0je55L40XPLm30TVu0p9PLF2tPh/yQ== X-Received: by 2002:a05:6402:2742:b0:43a:bd75:5e82 with SMTP id z2-20020a056402274200b0043abd755e82mr3645316edd.274.1657706584340; Wed, 13 Jul 2022 03:03:04 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id w7-20020a170906480700b0072b2cb1e22csm4769465ejq.104.2022.07.13.03.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:03:03 -0700 (PDT) Date: Wed, 13 Jul 2022 10:03:03 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Do not generate DW_TAG_typedef for constrained array types Message-ID: <20220713100303.GA994780@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" It no longer serves any useful purpose at this point. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/utils.cc (gnat_pushdecl): Build DECL_ORIGINAL_TYPE only for pointer types. diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -877,21 +877,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) { tree t = TREE_TYPE (decl); - /* Array and pointer types aren't tagged types in the C sense so we need - to generate a typedef in DWARF for them and make sure it is preserved, - unless the type is artificial. */ + /* Pointer types aren't named types in the C sense so we need to generate + a typedef in DWARF for them and make sure it is preserved, unless the + type is artificial. */ if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL) - && ((TREE_CODE (t) != ARRAY_TYPE && TREE_CODE (t) != POINTER_TYPE) - || DECL_ARTIFICIAL (decl))) + && (TREE_CODE (t) != POINTER_TYPE || DECL_ARTIFICIAL (decl))) ; - /* For array and pointer types, create the DECL_ORIGINAL_TYPE that will - generate the typedef in DWARF. Also do that for fat pointer types - because, even though they are tagged types in the C sense, they are - still XUP types attached to the base array type at this point. */ + /* For pointer types, create the DECL_ORIGINAL_TYPE that will generate + the typedef in DWARF. Also do that for fat pointer types because, + even though they are named types in the C sense, they are still the + XUP types created for the base array type at this point. */ else if (!DECL_ARTIFICIAL (decl) - && (TREE_CODE (t) == ARRAY_TYPE - || TREE_CODE (t) == POINTER_TYPE - || TYPE_IS_FAT_POINTER_P (t))) + && (TREE_CODE (t) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (t))) { tree tt = build_variant_type_copy (t); TYPE_NAME (tt) = decl; @@ -905,10 +902,6 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) DECL_ORIGINAL_TYPE (decl) = DECL_ORIGINAL_TYPE (TYPE_NAME (t)); else DECL_ORIGINAL_TYPE (decl) = t; - /* Array types need to have a name so that they can be related to - their GNAT encodings. */ - if (TREE_CODE (t) == ARRAY_TYPE && !TYPE_NAME (t)) - TYPE_NAME (t) = DECL_NAME (decl); /* Remark the canonical fat pointer type as artificial. */ if (TYPE_IS_FAT_POINTER_P (t)) TYPE_ARTIFICIAL (t) = 1;