aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_aggr.ads
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/sem_aggr.ads
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/sem_aggr.ads')
-rw-r--r--gcc/ada/sem_aggr.ads3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/sem_aggr.ads b/gcc/ada/sem_aggr.ads
index ee65210..75af8f7 100644
--- a/gcc/ada/sem_aggr.ads
+++ b/gcc/ada/sem_aggr.ads
@@ -43,4 +43,7 @@ package Sem_Aggr is
-- WARNING: There is a matching C declaration of this subprogram in fe.h
+ function Is_Null_Array_Aggregate_High_Bound (N : Node_Id) return Boolean;
+ -- Returns True for the high bound of a null array aggregate.
+
end Sem_Aggr;