From patchwork Fri Nov 4 13:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 15551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422889wru; Fri, 4 Nov 2022 07:05:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM601z1xKBQjZBw07WVT42QdiLRDlyVJyoTSLasiWQht3Y3mMkST1II8UXde6WsjNIbSWG2H X-Received: by 2002:a50:cc07:0:b0:453:4427:a918 with SMTP id m7-20020a50cc07000000b004534427a918mr36014250edi.121.1667570745722; Fri, 04 Nov 2022 07:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667570745; cv=none; d=google.com; s=arc-20160816; b=gwKQsvDHbHkFfzkTci90Ii58njv/RsHJn/H53iEc+HRaPPgxXJfpbnbz6S5FoawKoh JvpUyeiasOMSLoPephJVV5QX1ycdlgiSp86TDAa0NKx/VibjaJSLIeaxny3gKx87SokL zbtLypLchhOTD+HFvF0dQFESyQshb7dEnkfRHiOpTCdtDc3JoTxybTdkhMM7nie8JhSW C+qOZWHoHwjJp5i7CS2Irzpx4cAEwrj5BdRMTmNf732YFCxacHD3xYQAn3q5A4Ga2xDW BPvWRppTgBytwXk2PL4nPovYqfkKVCOiaRUiVDhQcjLbTPUPk3XYGVErmFYHcg2inj9w wo7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=abNuPyhwUQDPYaZEGoNBPZgUDhG6G5EvTKT2x3pTDaQ=; b=rWYWm7zaZqj2nnpjPzapgBdLX08We2npZ3e76wZRc4VxnqRVIA01dqFp6MhMS/4wL5 UybZk4Mu2bxjDTIYM6KmbW8JgyCQsftTUhKX4IGuBBA6oUJOJcOpJNaH+wBGATYEDDFI B7FYmL4qk1CwFQrjmgjcgPsqzhDeK58dVjuwn7ZVZcOpg8oVrbXsuDDXJVMbv9oYQ7fe KuclQA4sT9+suadFP5mrFf9dH+zUJlzn42ieebnh8yCcR4vAkmWii31zU9Ek4uLMbzMv kC/u3IjA7FSRhMg/tUpgaqTlvUUXPhbDQ182J07COVDjJK2SiDQ8zD77DQNdniH9AQ// EtNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SX7wx4AO; 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 w19-20020a056402269300b0045d53f8ea52si6205615edd.1.2022.11.04.07.05.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 07:05:45 -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=SX7wx4AO; 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 306EF3856DCE for ; Fri, 4 Nov 2022 14:00:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 306EF3856DCE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667570441; bh=abNuPyhwUQDPYaZEGoNBPZgUDhG6G5EvTKT2x3pTDaQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SX7wx4AOQXugyllAXBWWCmJTjR1utYLDsAVyn0/dredt5ohuNydroXmWhHfRaBFcx c7F3XII3diIF6ib4pNBN0L3qA3rQajvQNJ/1lHSLGhfKSo6XSdlEISQC1CluK6na8b sZCqkyeu6buYx/igXlMzcqXeXOumrt+1X7gfhyIQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 483F13857367 for ; Fri, 4 Nov 2022 13:58:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 483F13857367 Received: by mail-wr1-x431.google.com with SMTP id h9so7236907wrt.0 for ; Fri, 04 Nov 2022 06:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=abNuPyhwUQDPYaZEGoNBPZgUDhG6G5EvTKT2x3pTDaQ=; b=sMOX5qAkNj9Wt6UaogMeeU64u1aBOjyaIVCZckWm7+vUGKt9+TDdT5KSDiICiIuN2I nsu6ZNgY7Uedt/rdJVfaQz5a3BZBBDOFgt5AMuuBu1T4D7q3MSGhpAg4ObjmmdwlRgbL 9BDFLZ1Ar3gbEsIUvatkZ4sOT8JkfCM7bLl3O5wJQ6njK/XYrrcOtu2hKazAU/zqi3Ke QF0x5pgwB4kLlNOjKC9Gvs1sPEzaSe/J/ezHyGbKJO9I74Y4rtvDEn6oaT15AZL9Jl83 vYqX3utivSdSulRmRle/XDKMacIzzmXNHOJtw4ZD7uVw5nPn7ZZTYIq2dsJRnhUTXMx7 5LSg== X-Gm-Message-State: ACrzQf1il8Vs1mEnqrVv3HY9iqhs97VYw3SUxX6FLqZiktTCH4mBe//v x6Y3SPr7Vb0jxHsU3vEDKYWw77M+l/TyOA== X-Received: by 2002:adf:f609:0:b0:236:680b:8c65 with SMTP id t9-20020adff609000000b00236680b8c65mr23640463wrp.615.1667570309121; Fri, 04 Nov 2022 06:58:29 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id k4-20020a05600c1c8400b003b4cba4ef71sm3111794wms.41.2022.11.04.06.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:58:28 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITTED] ada: Static intrinsic functions are a core language extension. Date: Fri, 4 Nov 2022 14:58:24 +0100 Message-Id: <20221104135824.86935-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 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?= Cc: Steve Baird 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?1748574662171312490?= X-GMAIL-MSGID: =?utf-8?q?1748574662171312490?= From: Steve Baird GNAT-defined Ada extensions are divided into two categories: those that are enabled by either -gnatX or -gnatX0 and those which require -gnatX0. Move static intrinsic functions from the second category into the first. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Add the standard '... "On" enables this extension.' sentence to the description of static intrinsic functions. * sem_ch13.adb (Analyze_Aspect_Spec): In the call to Error_Msg_GNAT_Extension for a Static aspect specification for an intrinsic function, specify Is_Core_Extension => True. * sem_eval.adb (Eval_Intrinsic_Call): Test Core_Extensions_Allowed instead of testing All_Extensions_Allowed. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst | 2 ++ gcc/ada/gnat_rm.texi | 2 ++ gcc/ada/sem_ch13.adb | 3 ++- gcc/ada/sem_eval.adb | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 100d79e69b1..7e5fb700691 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -2200,6 +2200,8 @@ are identified below. functions and the compiler will evaluate some of these intrinsic statically, in particular the ``Shift_Left`` and ``Shift_Right`` intrinsics. + An Extensions_Allowed pragma argument of "On" enables this extension. + * ``[]`` aggregates This new aggregate syntax for arrays and containers is provided under -gnatX diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 6fcaca76571..fbd8bb8d6b2 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -3639,6 +3639,8 @@ The Ada 202x @code{Static} aspect can be specified on Intrinsic imported functions and the compiler will evaluate some of these intrinsic statically, in particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. +An Extensions_Allowed pragma argument of “On” enables this extension. + @item @code{[]} aggregates diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 6f4d33b6d55..2eb1a69e764 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2408,7 +2408,8 @@ package body Sem_Ch13 is elsif Is_Imported_Intrinsic then Error_Msg_GNAT_Extension - ("aspect % on intrinsic function", Sloc (Aspect)); + ("aspect % on intrinsic function", Sloc (Aspect), + Is_Core_Extension => True); else Error_Msg_N diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 6339cfe3b04..195f27e14d6 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -2856,10 +2856,11 @@ package body Sem_Eval is return; end if; - -- Intrinsic calls as part of a static function is a language extension. + -- Intrinsic calls as part of a static function is a (core) + -- language extension. if Checking_Potentially_Static_Expression - and then not All_Extensions_Allowed + and then not Core_Extensions_Allowed then return; end if;