diff options
author | Ed Schonberg <schonberg@adacore.com> | 2021-03-27 23:28:29 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-21 06:45:13 -0400 |
commit | c3681eba728a487f042de72e90c29b1cfca4e2e7 (patch) | |
tree | ae1f6f76a8f2f58aabe16968cf238ed88029feaf /gcc/ada/gen_il-gen-gen_nodes.adb | |
parent | 336438b6d225c3a5f28d57fd766e36f53faf8f3e (diff) | |
download | gcc-c3681eba728a487f042de72e90c29b1cfca4e2e7.tar.gz |
[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.
Diffstat (limited to 'gcc/ada/gen_il-gen-gen_nodes.adb')
-rw-r--r-- | gcc/ada/gen_il-gen-gen_nodes.adb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 13bdd71fb12..c50caeb8eab 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -610,7 +610,8 @@ begin -- Gen_IL.Gen.Gen_Nodes (Sy (Defining_Identifier, Node_Id), Sy (Formal_Type_Definition, Node_Id), Sy (Discriminant_Specifications, List_Id, Default_No_List), - Sy (Unknown_Discriminants_Present, Flag))); + Sy (Unknown_Discriminants_Present, Flag), + Sy (Default_Subtype_Mark, Node_Id))); Cc (N_Full_Type_Declaration, N_Declaration, (Sy (Defining_Identifier, Node_Id), |