aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch4.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2022-04-08 10:48:10 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-19 14:05:29 +0000
commit10c257afea5ee3803c4ebf3c0e66d20c66146743 (patch)
tree5074ef7a986c8e2fe0de0cdbf891951489de7d5f /gcc/ada/par-ch4.adb
parent054cf924ac00a47301a1c49f6433f70775fe1c0d (diff)
downloadgcc-10c257afea5ee3803c4ebf3c0e66d20c66146743.zip
gcc-10c257afea5ee3803c4ebf3c0e66d20c66146743.tar.gz
gcc-10c257afea5ee3803c4ebf3c0e66d20c66146743.tar.bz2
[Ada] Support Ada 2022 null array aggregates
Add support for Ada 2022's "[]" null array aggregates (thanks to Ed Schonberg for producing most of this patch). gcc/ada/ * erroutc.ads: Fix a single-character typo in a comment. * exp_aggr.adb: Fix a single-character typo in a comment. Replace several pairs of calls to Low_Bound and High_Bound (which do not handle an identifier that denotes a scalar subtype) with corresponding calls to Get_Index_Bounds (which does handle that case). * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Set the Component_Associations attribute of a null array aggregate to New_List. * sem_aggr.ads: New visible function Is_Null_Array_Aggregate_High_Bound. * sem_aggr.adb (Is_Null_Array_Aggregate_High_Bound, Is_Null_Aggregate, Resolve_Null_Array_Aggregate): New functions. (Resolve_Aggregate): Recognize null array aggregates (using Is_Null_Aggregate) and, when one is recognized, resolve it (using Resolve_Null_Array_Aggregate). Avoid calling Array_Aggr_Subtype for a null array aggregate; the needed subtype is built in Resolve_Null_Array_Aggregate. Do not incorrectly flag a null aggregate (after it is transformed by expansion) as being both positional and named. * sem_attr.adb (Eval_Attribute): Special treatment for null array aggregate high bounds to avoid incorrectly flagging something like Integer'Pred (Integer'First) as an illegal static expression. * sem_eval.adb (Out_Of_Range): Special treatment for null array aggregate high bounds to avoid incorrectly flagging something like Integer'Pred (Integer'First) as an illegal static expression.
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r--gcc/ada/par-ch4.adb1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index e0f3ca9..4ab4dcb 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -1405,6 +1405,7 @@ package body Ch4 is
Scan; -- past ]
Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc);
Set_Expressions (Aggregate_Node, New_List);
+ Set_Component_Associations (Aggregate_Node, New_List);
Set_Is_Homogeneous_Aggregate (Aggregate_Node);
return Aggregate_Node;
end if;