public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1261] ada: Simplify expansion of positional aggregates
@ 2023-05-26 7:35 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-26 7:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c8c37d2bfde00ec3ac8083502dbbe04f0b213298
commit r14-1261-gc8c37d2bfde00ec3ac8083502dbbe04f0b213298
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Thu Mar 16 10:36:20 2023 +0100
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.
Diff:
---
gcc/ada/exp_aggr.adb | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index bbc0f408abc..60449fbeb2d 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-26 7:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 7:35 [gcc r14-1261] ada: Simplify expansion of positional aggregates Marc Poulhi?s
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).