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: 70276 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 2EA72384F1F2 for ; Tue, 30 May 2023 07:21:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EA72384F1F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685431287; 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=TGuxps+e3Uk6f0ePntHy6hKBn39M7m2c6Zf1PAzaOfQbod58p5SyB9Ilefm0u5M64 Sj5jIjq/uvuTHXOcRIOFg6xS5EZhb0S0LMJMaO/P8zEm7jv9xX8kjTiwjKwQ6LQ+7s JCAeswqSq4oOJpgGhYe9PQZhWKywoLf/sPpCpdx8= 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-Google-Smtp-Source: ACHHUZ7kx5xTkaFELKo1CG+KydOOkTFzwewPJGGTgEzfotwbgEADx05cxcI+HSm9uVG+P0/U0LVKFw== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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);