From patchwork Wed Jul 6 13:31:32 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: 1652993 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=OG/fFmVE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4LdL9X5tsqz9s09 for ; Wed, 6 Jul 2022 23:34:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D0E438485A8 for ; Wed, 6 Jul 2022 13:34:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D0E438485A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657114446; bh=WwJUdYthccjJZj6cnzUG5EVebmqhja2Tsl72H+nE6Ic=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OG/fFmVEtGy+ov3o46bkN4FAbxv07sQ5+JrX/vxBKsmN0ln41uJ9y+1qbIc3GdZ5s vbiw0YvYeJRAowzstSnuU5Plaif0160eJA8EoZ6GjPO1O0VXgaUMj+JsJDfEjlUvja YRy6Zra7dPgQ7tlkuriLpOibYtdt5O0bqaJbMsBQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 47EA03857C7D for ; Wed, 6 Jul 2022 13:31:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 47EA03857C7D Received: by mail-wr1-x430.google.com with SMTP id o4so22108235wrh.3 for ; Wed, 06 Jul 2022 06:31:35 -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=WwJUdYthccjJZj6cnzUG5EVebmqhja2Tsl72H+nE6Ic=; b=50e74TvvkC4vaa+H5fsz/tNRdudyaZYKJ+UV+/nOpfJJ8rSS5IwB1MYwhUiawo1lxb 9Rkk32PuSDdzQTgJTbnm8HQ0CIyGOYt90fRuTqal69+SPzwj6FGt5KpqrBokY3Ls4RyC AHHtGwz1yNmjgUqnUpcCnX1epJKtY7RAeCVwX0RQ+6ySJ3RtEICKBP4JSb2Vzckg24Qv W8Nj+hri0a4wA3477jQg/CldXevt1yYZQ6h9bwC7toSrmlWkb9c0+PPzwao6EIzQk1F6 HvKorvRow2vHS1Od/Rli+H7F4+nvigMgmV9YFh6lMtU3+tavi2Nul57vtH4KRxm+5Bqv 0LJw== X-Gm-Message-State: AJIora/njIvZDGMnP1vwo8Tidq9kFnGr9kPR1ZEeka3vlo3w6Z0cw+Dj lIYDTojgdyMd6g4C/pZp8r/hkM+tgg4Dlg== X-Google-Smtp-Source: AGRyM1vjD9YzwNrPyWnUYy93KOL6LSvFdnZ1dk/zkl1BbupyZsFHPOZlW+6sIyWKLptEsu9mS2cqWg== X-Received: by 2002:a05:6000:15c6:b0:21d:17da:29ca with SMTP id y6-20020a05600015c600b0021d17da29camr37527130wry.94.1657114293968; Wed, 06 Jul 2022 06:31:33 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id k1-20020a5d6281000000b0021b9e360523sm36634042wru.8.2022.07.06.06.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 06:31:33 -0700 (PDT) Date: Wed, 6 Jul 2022 13:31:32 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Small tweak to gnat_to_gnu_subprog_type Message-ID: <20220706133132.GA2206818@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 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" No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Constify a local variable and move a couple of others around. diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -5777,10 +5777,9 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, bool debug_info_p, tree *param_list) { const Entity_Kind kind = Ekind (gnat_subprog); + const Entity_Id gnat_return_type = Etype (gnat_subprog); const bool method_p = is_cplusplus_method (gnat_subprog); const bool variadic = IN (Convention (gnat_subprog), Convention_C_Variadic); - Entity_Id gnat_return_type = Etype (gnat_subprog); - Entity_Id gnat_param; tree gnu_type = present_gnu_tree (gnat_subprog) ? TREE_TYPE (get_gnu_tree (gnat_subprog)) : NULL_TREE; tree gnu_return_type; @@ -5810,7 +5809,6 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, bool return_by_direct_ref_p = false; bool return_by_invisi_ref_p = false; bool incomplete_profile_p = false; - int num; /* Look into the return type and get its associated GCC tree if it is not void, and then compute various flags for the subprogram type. But make @@ -5944,6 +5942,8 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, /* Loop over the parameters and get their associated GCC tree. While doing this, build a copy-in copy-out structure if we need one. */ + Entity_Id gnat_param; + int num; for (gnat_param = First_Formal_With_Extras (gnat_subprog), num = 0; Present (gnat_param); gnat_param = Next_Formal_With_Extras (gnat_param), num++)