diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-03-16 10:36:20 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-26 09:29:15 +0200 |
commit | c8c37d2bfde00ec3ac8083502dbbe04f0b213298 (patch) | |
tree | a889df0af0d109a03d5ad9630a7174a6599e8a88 /gcc/ada/exp_aggr.adb | |
parent | d874abd8b7f4574d5a3ad8a918abbf7608250dbf (diff) | |
download | gcc-c8c37d2bfde00ec3ac8083502dbbe04f0b213298.zip gcc-c8c37d2bfde00ec3ac8083502dbbe04f0b213298.tar.gz gcc-c8c37d2bfde00ec3ac8083502dbbe04f0b213298.tar.bz2 |
ada: Simplify expansion of positional aggregates
Code cleanup; semantics is unaffected.
gcc/ada/
* exp_aggr.adb (Build_Constrained_Type): Use List_Length to count
expressions in consecutive subaggregates.
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index bbc0f40..60449fb 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -5837,7 +5837,6 @@ package body Exp_Aggr is procedure Build_Constrained_Type (Positional : Boolean) is Loc : constant Source_Ptr := Sloc (N); Agg_Type : constant Entity_Id := Make_Temporary (Loc, 'A'); - Comp : Node_Id; Decl : Node_Id; Typ : constant Entity_Id := Etype (N); Indexes : constant List_Id := New_List; @@ -5853,19 +5852,14 @@ package body Exp_Aggr is Sub_Agg := N; for D in 1 .. Number_Dimensions (Typ) loop - Sub_Agg := First (Expressions (Sub_Agg)); - - Comp := Sub_Agg; - Num := 0; - while Present (Comp) loop - Num := Num + 1; - Next (Comp); - end loop; + Num := List_Length (Expressions (Sub_Agg)); Append_To (Indexes, Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => Make_Integer_Literal (Loc, Num))); + + Sub_Agg := First (Expressions (Sub_Agg)); end loop; else |