From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Steve Baird <baird@adacore.com>
Subject: [COMMITTED] ada: Static intrinsic functions are a core language extension.
Date: Fri, 4 Nov 2022 14:58:24 +0100 [thread overview]
Message-ID: <20221104135824.86935-1-poulhies@adacore.com> (raw)
From: Steve Baird <baird@adacore.com>
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
reply other threads:[~2022-11-04 13:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221104135824.86935-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=baird@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).