From patchwork Mon May 22 08:50:47 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: 97199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1305129vqo; Mon, 22 May 2023 02:03:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7gbTRbyI8/8mKZ6mr67aACfypRvcXiMFXK2SXDqLMtTi2tGvSlAy0iHSYXOOuOCFZX1NDk X-Received: by 2002:a17:907:7647:b0:94e:9a73:1637 with SMTP id kj7-20020a170907764700b0094e9a731637mr8605095ejc.75.1684746237528; Mon, 22 May 2023 02:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684746237; cv=none; d=google.com; s=arc-20160816; b=ypkAgyla6vT6p4hWfE+CLSCjgv918qn0gTPkcuK7J2GYn0B+iPz7yV4++90FEJUW6j 7uF4OTHRsYyC+CVVEAVz7q6/RrNbZBfU0dot2Es1fAG1BtLC7gHpxs0Zf9ZPMvIJqclB ekmVTrtApDUDjV9rINDr+/lhdzGcKysoSqg2ajkdtDNpX5hwW/8b9TZf3OL7/SU46uL8 aTFqZ1LeVe6BCKDa3YLcvMNdtZXJGnxW68/fysbiX1tGhWtSYVL+f6a1HQaGjTy6rPei RsyqNZFmzAhDs2Gl22eokZ4/ScF6SmrmbYyBhggMJ9qBQUDLw7xPv0dW3wdVtvmzoUV6 xk4Q== 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=NyDT+8/6UxhIeP0gKwJftr1PrewdtulxvePEbzi/lic=; b=df8Pp793Npux45i/vHIw1uro377pAySGLGuuNz8ToPt6Fx+J0mPORLf71HRxzfeIKx UVMaovzVbcbCyHVMg35D3Rd2vH6TK2z/kCN+uFOKD6I9E4MS6RuAww4gqPQ6onzPdqCF /bJ7biliSEDmadP8vQ5KaRXB1wEdswk4xuY7es6NmVK2kFkrLJN6TovA91teqHpX1GEP uT6TAQs0geybb4jVNzXiNtSMJ5iUH8DywRF4oX9+9SwuuuhWOidDEZnWWnDpO3SD2E8w yzKHMuRi/AJtTHKmTc809zPWXotIwdbWmXlBrcf6Hk3BieFhlBV1608T29oa4Nybu/Ly QS1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YgLG8oUH; 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 az5-20020a170907904500b00957e7c30d27si3341342ejc.1051.2023.05.22.02.03.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 02:03:57 -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=YgLG8oUH; 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 14A1B382E69C for ; Mon, 22 May 2023 08:56:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14A1B382E69C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684745782; bh=NyDT+8/6UxhIeP0gKwJftr1PrewdtulxvePEbzi/lic=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=YgLG8oUHGyHIi4uSrBzdtZqL35cdUERfRvnwOt2fwALDABFsG5QvIM4/VcsELGSjL awJcWiDt69BnKD7WT1OJQ+c2bYN1tezDQcYzgq6H0bLyNtD+XSdpDGgkG6l4ogTa97 HSIf5og8CIequdVbJM+iBD+6GN2ggwbFCZpX8wUw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 1AF2738323F7 for ; Mon, 22 May 2023 08:50:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AF2738323F7 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f60804faf4so963645e9.3 for ; Mon, 22 May 2023 01:50:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745449; x=1687337449; 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=NyDT+8/6UxhIeP0gKwJftr1PrewdtulxvePEbzi/lic=; b=G+GdY50jOqTibb6YwQ9d6S1n+UI08iTgYLIeRfseW1uLVc6l/wyUkKi+IcIWnDkJ8V Vt2V0g0ZgLpSbN0BP301G/a6I8xkEzfzSTNHU9GHDUGDeBYSjTo1FoT6NAeJXSdBaHj/ 8HVRgOj7Ftsj9ltmatZN0Vcl61Xk6ha5D5a7+JAvZxhISpVUNo9xddDI2IcQFN3XOIgx R69hBmUChLpGQthF5SAA9yAZvDsaoeIayIyI2/J4WwZdvBpNBsRQP1Y0YEuI3Zev7Mz+ E3pGFUt9e3gZogjDfrsYa8P1tXEXwPfBvjhCHCiLKve5/RivhMOHPY9Ec2blFI/cXZzl tXvQ== X-Gm-Message-State: AC+VfDySibeiGtd/b4A2f235Xm0AYWwHun3L1dPR4cNtZgt96pi7c3RR G1hwPukQW11u8IYZrGpWEZ6YcXJKmcsYOMN+np1cQQ== X-Received: by 2002:a1c:790c:0:b0:3f1:6ef6:c9d0 with SMTP id l12-20020a1c790c000000b003f16ef6c9d0mr7156830wme.17.1684745449033; Mon, 22 May 2023 01:50:49 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id g3-20020a7bc4c3000000b003f427687ba7sm7521333wmk.41.2023.05.22.01.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:50:48 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED] ada: Accept Assert pragmas in expression functions Date: Mon, 22 May 2023 10:50:47 +0200 Message-Id: <20230522085047.1726616-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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?1766584470969414231?= X-GMAIL-MSGID: =?utf-8?q?1766584470969414231?= From: Steve Baird gcc/ada/ * sem_ch4.adb (Analyze_Expression_With_Actions.Check_Action_Ok): Accept an executable pragma occuring in a declare expression as per AI22-0045. This means Assert and Inspection_Point pragmas as well as any implementation-defined pragmas that the implementation chooses to categorize as executable. Currently Assume and Debug are the only such pragmas. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch4.adb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index e9c5b9f8a33..5b013dfb63d 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -2411,10 +2411,27 @@ package body Sem_Ch4 is return; -- ???For now; the RM rule is a bit more complicated end if; + when N_Pragma => + declare + -- See AI22-0045 pragma categorization. + subtype Executable_Pragma_Id is Pragma_Id + with Predicate => Executable_Pragma_Id in + -- language-defined executable pragmas + Pragma_Assert | Pragma_Inspection_Point + + -- GNAT-defined executable pragmas + | Pragma_Assume | Pragma_Debug; + begin + if Get_Pragma_Id (A) in Executable_Pragma_Id then + return; + end if; + end; + when others => - null; -- Nothing else allowed, not even pragmas + null; -- Nothing else allowed end case; + -- We could mention pragmas in the message text; let's not. Error_Msg_N ("object renaming or constant declaration expected", A); end Check_Action_OK;