From patchwork Tue May 30 07:20:53 2023 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: 100580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1995067vqr; Tue, 30 May 2023 00:22:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ddJ3/Bb2eq95TJK2gcwjPzWactMVo+gMMA+UjjZnz8z4QUEdfBmdm+F5jAgH0mHK8OI6B X-Received: by 2002:a17:907:86a9:b0:961:a67:28d with SMTP id qa41-20020a17090786a900b009610a67028dmr1577740ejc.22.1685431368994; Tue, 30 May 2023 00:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685431368; cv=none; d=google.com; s=arc-20160816; b=RpoOwm3h6cYv0deRdst07KVbqME5Gkt3w7F0HHvehht8jLisrkWQgTgkx/HsH67Sk4 3WfYiiJ7VTQX0K39FzE09/JfBYYdk9hR09jTVqE3sWvYnVJBbX4mwOngNq6iUPzqeXT3 ukMSgfrGRwj5QTAUKAYpMNMWcuLd+KA9ELAFXAjvFqFFKCvOybaOBzvmLUb99r9NUiAl p9A/4naVl+0qvS1GCp0zT9/2oAmsR4FOKSnnY3WqacNPB3Yd91XTBPB89a0nV7T+sslP YAididWy9lbq2sa121gSHso76T8Uc5mFsAzgDwydMAy2TfVvkLn0M8lXsJN9Yjr8hNIY RczQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=MeUJAkh5+S6WfliXsEPRhHmXmNLPZBqYVKt9qZWeJzU=; b=SKoH2ULGK5HPcQaNSUibzpw8GLRZUMpt/8cXvfxrLPPrnTiPS7wOdGrwDV9rYx3ZQR bZ19IBk3AOMz4y7B5hAJzacJ/EF1xDSOq9bkmNMbK4ueAxpv530RaJInsAccytMQfulC RRGNaOrqsZbECXzhW1hBNbPBP4XFR/Tfazfjsp6S/3czymJuJhNu9XdtcQMsLEplbI4Q Pz4hW2gB0IcYZeSNFRRHObX1qNLZH7EPVLoSKoYH+sUa4tyIF6ouubP3mpoCngyvd8ax d300GYfHdcmZMnvHQUFsOan6Zc0jRfk6+WMScSxistBnUCPHmbeuuDi7xJU+gNWMhzh6 va0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rCwgAe9t; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ss5-20020a170907c00500b0096f93bd90b6si876507ejc.63.2023.05.30.00.22.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rCwgAe9t; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5570A384FDDE for ; Tue, 30 May 2023 07:21:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5570A384FDDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685431305; bh=MeUJAkh5+S6WfliXsEPRhHmXmNLPZBqYVKt9qZWeJzU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=rCwgAe9t3s+ZYkMSh3Iisbe/gG34ghX90++ysQKIdOdDIDJ56jCaCaB+fLR8w8Kaj Ord7Hf5BkPUqR2kzOy5ifeLayWi3i+5b6p/V25qPXctgrRWhD3DnyM31zTv6yTvEoN eKGi3pDTaoHEz4MzxE/es8f5NATsgKwRjlDab3XQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id D3DCA3854E44 for ; Tue, 30 May 2023 07:20:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3DCA3854E44 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-30ad752f433so2422282f8f.3 for ; Tue, 30 May 2023 00:20:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685431254; x=1688023254; 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=MeUJAkh5+S6WfliXsEPRhHmXmNLPZBqYVKt9qZWeJzU=; b=LYV4Q8oiAQ92yDd6HeSF212QmVwsgOFrDxlVgPVwGPDxffTUQlcwiLLlGm71VxC7bZ hrhRd28sIpmzeHnSdeX1O1O32iElSwVxy/2HnzWwi+5QCShUjUqXbs6hFh/EOyuhLewy dVp17JSYOz19N7o2uYWorZQtnMHEqvNSoqVcLPbwLSNcIxYqPPn1DpgHFQ0sHQMD0e+v nHsy+/7LUnF0mSTv5B6qv7B8RUSRw0Cb7lfMeC6iPVitqOrjv1faIMJEj0Rbq6smjxhl VdoFfCAUGLX+ZPONo/XpYvS16yT7bM4bfHWFznh8HIkw1C5+I/E/r1M19xRcX7tF2mpB SPmQ== X-Gm-Message-State: AC+VfDxF0ErOemN1KFh6Tgt3rQ1Q/KrVpgSpRNiIXVfEsY9+QpBCWGZN m0WMvtl23W1pIO9gufTDNxQMHbYP/WcCZBayAOI6fw== X-Received: by 2002:a5d:4849:0:b0:30a:e542:c5c9 with SMTP id n9-20020a5d4849000000b0030ae542c5c9mr817672wrs.24.1685431254747; Tue, 30 May 2023 00:20:54 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:7733:a608:a415:6b2a]) by smtp.gmail.com with ESMTPSA id r7-20020a5d4e47000000b00307c46f4f08sm2228962wrt.79.2023.05.30.00.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:20:54 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Only build access-to-subprogram wrappers when expander is active Date: Tue, 30 May 2023 09:20:53 +0200 Message-Id: <20230530072053.2499889-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767302883372557777?= X-GMAIL-MSGID: =?utf-8?q?1767302883372557777?= From: Piotr Trojanek For access-to-subprogram types with Pre/Post aspects we create a wrapper routine that evaluates these aspects. Spec of this wrapper was created always, while its body was only created when expansion was enabled. Now we only create these wrappers when expansion is enabled. In particular, we don't create them in GNATprove mode; instead, GNATprove picks the Pre/Post expressions directly from the aspects. gcc/ada/ * exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Build wrapper body if requested by routine that builds wrapper spec. * sem_ch3.adb (Analyze_Full_Type_Declaration): Only build wrapper when expander is active. (Build_Access_Subprogram_Wrapper): Remove special-case for GNATprove. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 4 ---- gcc/ada/sem_ch3.adb | 12 ++---------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 5f651bacafb..f8c99470dd7 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -583,10 +583,6 @@ package body Exp_Ch3 is Ptr : Entity_Id; begin - if not Expander_Active then - return; - end if; - -- Create List of actuals for indirect call. The last parameter of the -- subprogram declaration is the access value for the indirect call. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index f360be810b4..29733e9d31f 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3224,6 +3224,7 @@ package body Sem_Ch3 is if Ada_Version >= Ada_2022 and then Present (Aspect_Specifications (N)) + and then Expander_Active then Build_Access_Subprogram_Wrapper (N); end if; @@ -6915,16 +6916,7 @@ package body Sem_Ch3 is -- may be handled as a dispatching operation and erroneously registered -- in a dispatch table. - if not GNATprove_Mode then - Append_Freeze_Action (Id, New_Decl); - - -- Under GNATprove mode there is no such problem but we do not declare - -- it in the freezing actions since they are not analyzed under this - -- mode. - - else - Insert_After (Decl, New_Decl); - end if; + Append_Freeze_Action (Id, New_Decl); Set_Access_Subprogram_Wrapper (Designated_Type (Id), Subp); Build_Access_Subprogram_Wrapper_Body (Decl, New_Decl);