]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Implementation of AI12-205: defaults for formal types
authorEd Schonberg <schonberg@adacore.com>
Sun, 28 Mar 2021 03:28:29 +0000 (23:28 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 21 Jun 2021 10:45:13 +0000 (06:45 -0400)
commitc3681eba728a487f042de72e90c29b1cfca4e2e7
treeae1f6f76a8f2f58aabe16968cf238ed88029feaf
parent336438b6d225c3a5f28d57fd766e36f53faf8f3e
[Ada] Implementation of AI12-205: defaults for formal types

gcc/ada/

* gen_il-fields.ads: Add Default_Subtype_Mark to enumeration
type for fields.
* gen_il-gen-gen_nodes.adb: Add call to create new field for
Formal_Type_Declaration node.
* par-ch12.adb (P_Formal_Type_Declaration): in Ada_2022 mode,
recognize new syntax for default: "or use subtype_mark".
(P_Formal_Type_Definition): Ditto for the case of a formal
incomplete type.
* sinfo.ads: Add field Default_Subtype_Mark to
N_Formal_Type_Declaration.
* sem_ch12.adb (Validate_Formal_Type_Default): New procedure, to
apply legality rules to default subtypes in formal type
declarations. Some legality rules apply to all defaults, such as
the requirement that the default for a formal type that depends
on previous formal entities must itself be a previously declared
formal of the same unit. Other checks are kind- specific.
(Analyze_Associations): Use specified default if there is no
actual provided for a formal type in an instance.
(Analyze_Formal_Type_Declaration): Call
Validate_Formal_Type_Default when default subtype is present.
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen-gen_nodes.adb
gcc/ada/par-ch12.adb
gcc/ada/sem_ch12.adb
gcc/ada/sinfo.ads