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/sem_case.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/sem_case.adb')
-rw-r--r-- | gcc/ada/sem_case.adb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 2810d3e..5042c9e 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -3581,7 +3581,7 @@ package body Sem_Case is -- Hold on, maybe it isn't a complete mess after all. - if Extensions_Allowed and then Subtyp /= Any_Type then + if Core_Extensions_Allowed and then Subtyp /= Any_Type then Check_Composite_Case_Selector; Check_Case_Pattern_Choices; end if; @@ -3864,7 +3864,7 @@ package body Sem_Case is function Is_Case_Choice_Pattern (Expr : Node_Id) return Boolean is E : Node_Id := Expr; begin - if not Extensions_Allowed then + if not Core_Extensions_Allowed then return False; end if; |