From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x431.google.com with SMTP id h9so7236907wrt.0 for ; Fri, 04 Nov 2022 06:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=abNuPyhwUQDPYaZEGoNBPZgUDhG6G5EvTKT2x3pTDaQ=; b=LjYfBTRahpQwNInWpcsl/ZjMU2m2PdtmXZD6C+OAkG2YDQEKc84HwZlb3z4yYr4pg+ cNV0DxOI6PC+VEuwP64c/jr9pDvJ/CJ91LAgvizHWiLSG99UHskdPeGMmm2Dv3edkWJ1 8n5T71Thh5cvrPCueF7PtwApMOAfFm7Mg+N3x0U29UZmmrn7SrisXvuXPGecwP1iBqxu TJ7YEZf9ynfc99Gki895yj0BwHFzZEayx5P0ZVeV9g5v0Vx1g92urUKOwWVTzu92X8SG qHxQfecQFwTQZ4oN7USI9V5CebHRMfzr09Z6Ah9CQC7ONLAVRodow5/dHl9RkvB0j+0r Ufpw== 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-Google-Smtp-Source: AMsMyM5GjGLDqO3iVKb0q4R72MP8RFM+GmfKlf01aD4gZWnWXCaAAhGGssbzBXwiB3xeD8vCzo8/Gw== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 List-Id: 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; -- 2.34.1