From patchwork Mon May 6 09:18:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1931876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=HWJNaS3X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VXx0c3FLkz1yZk for ; Mon, 6 May 2024 19:28:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B1E0E3858426 for ; Mon, 6 May 2024 09:28:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 306583858C62 for ; Mon, 6 May 2024 09:18:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 306583858C62 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 306583858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714987132; cv=none; b=Reenfh1MXgp7Wpaecl2k6h3xHqXv85dAO9GPfG1rrzyflfL9VIGM7ygv2iG9IdEWtVETvCqAcU6oE5KXLULSQXoBA7o1mpZYBQmLUHFOPT14QsNdBrxkzbvwdjX7yrVzZVj716Vv0KA9exJXxl/+obOi8//A13IQdJOwf6xqePo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714987132; c=relaxed/simple; bh=9oLFR+xAqnIsCHrmex7npWSVD4biWuYt9xT6qL/6a7w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WZb42t71oCkufMsBq3HajBpsMcDbyfazZh87T/wZ/nwp+UuuCFGNc8BePIq2qj0OJ2LSU+H2p9y6K4HzE8Vml0TItI2uLEnd54bPIhwiSTu7BDEdeQE/XRRHeiGoAVbSQ8Dgx6cbSntO58bI2gtICoIynr0kUVxy+rbh2cm3RuU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-34f52fc2191so217958f8f.1 for ; Mon, 06 May 2024 02:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1714987129; x=1715591929; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2/5iuSEd1wlKVa8aBbrOqcPVTkP6VdVPt1BRnniYFRU=; b=HWJNaS3X3TFVt+7un/uhwjOSOtKAg57lpdyDxc5Y8RVDMMzcD9IEfBm28KEQfqvgCD ymyzu3n0jv2Oeve/xuDgfmDVpuM+Go+tlSDRymU2oFtEjCirh33GLSJJ/ax6bogGPLfX vAlYde6cdbg43rhBlXnL6VUoyy/eA1IpEaGzquSmMn5pF1ROTsjcmOW+EX8Rpa4MyQFx s+HDVEvuZCtbqa6uZwgxDHTBr7Bacx3rBlbqxP8Fr4y3eS9//cHMX7ZVLm8YYkS6fH0T RHQSMC4x9+T2MdrhAFFBFe6v/a0UdAUb9VL++uhAmCONlYtP6gNkKPr61Qys1BL1x8y8 cQTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714987129; x=1715591929; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2/5iuSEd1wlKVa8aBbrOqcPVTkP6VdVPt1BRnniYFRU=; b=HXBr04WcN08LZws0uH+Lc6yhupOHLCHqPUHUi3zb8m0nnXGfk2FXVgSRaP7/rZ0qqA tEQCWxQ3m6NpP+MphVtWNSJrqGSfcFiDI8IBkyOLrZLvjdeh28HIVmeXz3XWIXbWfWFO LXj1I7ehSOrr2QmuI54M373CDWO7b49r7Pn29kAj3+zy1eVdxHNzhdNG53sSdVzUM8Nr wda+Qqmzo15QlwvxBArYdzXdIUYRWNCtCCKzpj7+UCUMLBYT4HNuXJZN1L2qEFYTNKo3 yQrop0bmk8eZHT3ojJNsW+T6PayxQKTBVJZ578B+Gd6f/KU4lqEnqWhX4wAd1su09BpI 4dBg== X-Gm-Message-State: AOJu0YzskI3iKXQzIStG6MQZyOqWo5jaNLp29ezp+LcuFKRbOGbKCaq3 7d2iZhYOCfDKDuFuHg/qQbKIWPIUquZ7VkalksurkdsG+4cARu3RQt/JSwom0HCRMR2THyIwP/s = X-Google-Smtp-Source: AGHT+IHhfGG5cWOv6ViJGANfHvXV+1Rttk4BvQ0x+nB+mmdiKo6QuMkolVnKbt9QzESbXvXDPlE/jA== X-Received: by 2002:a05:6000:1867:b0:34e:4cc2:7015 with SMTP id d7-20020a056000186700b0034e4cc27015mr7707139wri.31.1714987128995; Mon, 06 May 2024 02:18:48 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:9ea2:39d7:df74:396d]) by smtp.gmail.com with ESMTPSA id f3-20020adfb603000000b0034dced2c5bdsm10187884wre.80.2024.05.06.02.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 02:18:48 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Cleanup collecting of implicit outputs Date: Mon, 6 May 2024 11:18:47 +0200 Message-ID: <20240506091847.1586786-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Piotr Trojanek Move handling of IN parameters to where both IN and IN OUT parameters are handled. This makes the code marginally more efficient and symmetrical to handling of implicit inputs. gcc/ada/ * sem_prag.adb (Collect_Global_Item): Move code. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ab60a8ad1d5..25a98cb414e 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -31651,6 +31651,17 @@ package body Sem_Prag is while Present (Formal) loop if Ekind (Formal) in E_In_Out_Parameter | E_In_Parameter then Append_New_Elmt (Formal, Subp_Inputs); + + -- IN parameters of procedures and protected entries can act as + -- outputs when the related type is access-to-variable. + + if Ekind (Formal) = E_In_Parameter + and then Ekind (Spec_Id) not in E_Function + | E_Generic_Function + and then Is_Access_Variable (Etype (Formal)) + then + Append_New_Elmt (Formal, Subp_Outputs); + end if; end if; if Ekind (Formal) in E_In_Out_Parameter | E_Out_Parameter then @@ -31667,17 +31678,6 @@ package body Sem_Prag is end if; end if; - -- IN parameters of procedures and protected entries can act as - -- outputs when the related type is access-to-variable. - - if Ekind (Formal) = E_In_Parameter - and then Ekind (Spec_Id) not in E_Function - | E_Generic_Function - and then Is_Access_Variable (Etype (Formal)) - then - Append_New_Elmt (Formal, Subp_Outputs); - end if; - Next_Formal (Formal); end loop;