diff options
author | Steve Baird <baird@adacore.com> | 2022-09-30 15:27:00 -0700 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-11-04 14:47:24 +0100 |
commit | 1e78b49adb52ccf9493515ae002d87f3af1f5de9 (patch) | |
tree | dc255aac6355787df6cee090f9da4a9d79571a6a /gcc/ada/par-ch4.adb | |
parent | c07da8567bfc67bd28191f63a9247566260063ad (diff) | |
download | gcc-1e78b49adb52ccf9493515ae002d87f3af1f5de9.zip gcc-1e78b49adb52ccf9493515ae002d87f3af1f5de9.tar.gz gcc-1e78b49adb52ccf9493515ae002d87f3af1f5de9.tar.bz2 |
ada: Allow enabling a restricted set of language extensions.
The -gnatX switch (and the related Extensions_Allowed pragma) is currently a
two-valued all-or-nothing option. Add support for enabling a curated subset
of language extensions without enabling others via the -gnatX switch
and for enabling all language extensions via the new -gnatX0 switch.
Similarly, the existing "ON" argument for the Extensions_Allowed pragma
now only enables the curated subset; the new argument "ALL" enables all
language extensions. The subset of language extensions currently includes
prefixed-view notation with an untagged prefix, fixed-low-bound array
subtypes, and casing on composite values.
gcc/ada/
* opt.ads: Replace Ada_Version_Type enumeration literal
Ada_With_Extensions with two literals, Ada_With_Core_Extensions
and Ada_With_All_Extensions. Update uses of the deleted literal.
Replace Extensions_Allowed function with two functions:
All_Extensions_Allowed and Core_Extensions_Allowed.
* errout.ads, errout.adb: Add Boolean parameter to
Error_Msg_GNAT_Extension to indicate whether the construct in
question belongs to the curated subset.
* exp_ch5.adb, par-ch4.adb, sem_case.adb, sem_ch3.adb:
* sem_ch4.adb, sem_ch5.adb, sem_ch8.adb: Replace calls to
Extensions_Allowed with calls to Core_Extensions_Allowed for
constructs that are in the curated subset.
* sem_attr.adb, sem_ch13.adb, sem_eval.adb, sem_util.adb: Replace
calls to Extensions_Allowed with calls to All_Extensions_Allowed
for constructs that are not in the curated subset.
* par-ch3.adb: Override default for new parameter in calls to
Error_Msg_GNAT_Extension for constructs in the curated subset.
* par-prag.adb: Add Boolean parameter to Check_Arg_Is_On_Or_Off to
also allow ALL. Set Opt.Ada_Version appropriately for ALL or ON
arguments.
* sem_prag.adb: Allowed ALL argument for an Extensions_Allowed
pragma. Set Opt.Ada_Version appropriately for ALL or ON arguments.
* switch-c.adb: The -gnatX switch now enables only the curated
subset of language extensions (formerly it enabled all of them);
the new -gnatX0 switch enables all of them.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Document new "-gnatX0" switch and update documentation for
"-gnatX" switch.
* doc/gnat_rm/implementation_defined_pragmas.rst: Document new ALL
argument for pragma Extensions_Allowed and update documentation
for the ON argument. Delete mention of Ada 2022 Reduce attribute
as an extension.
* gnat_rm.texi, gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r-- | gcc/ada/par-ch4.adb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 0dc6c8a..82b09b2 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -1775,7 +1775,7 @@ package body Ch4 is if Token = Tok_Identifier then Id := P_Defining_Identifier; if Token = Tok_Greater then - if Extensions_Allowed then + if Core_Extensions_Allowed then Set_Box_Present (Assoc_Node); Set_Binding_Chars (Assoc_Node, Chars (Id)); Box_Present := True; @@ -1813,7 +1813,7 @@ package body Ch4 is if Token = Tok_Identifier then Id := P_Defining_Identifier; - if not Extensions_Allowed then + if not Core_Extensions_Allowed then Error_Msg_GNAT_Extension ("IS following component association", Token_Ptr); elsif Box_With_Identifier_Present then |