]> gcc.gnu.org Git - gcc.git/commit - gcc/ada/sem_ch3.adb
ada: Allow enabling a restricted set of language extensions.
authorSteve Baird <baird@adacore.com>
Fri, 30 Sep 2022 22:27:00 +0000 (15:27 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 4 Nov 2022 13:47:24 +0000 (14:47 +0100)
commit1e78b49adb52ccf9493515ae002d87f3af1f5de9
treedc255aac6355787df6cee090f9da4a9d79571a6a
parentc07da8567bfc67bd28191f63a9247566260063ad
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.
22 files changed:
gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
gcc/ada/errout.adb
gcc/ada/errout.ads
gcc/ada/exp_ch5.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/par-ch3.adb
gcc/ada/par-ch4.adb
gcc/ada/par-prag.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_case.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch5.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_eval.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/switch-c.adb
This page took 0.063899 seconds and 5 git commands to generate.