* [COMMITTED] ada: Seize opportunity to reuse List_Length
@ 2023-10-19 14:41 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-10-19 14:41 UTC (permalink / raw)
To: gcc-patches; +Cc: Ronan Desplanques
From: Ronan Desplanques <desplanques@adacore.com>
This patch is intended as a readability improvement. It doesn't
change the behavior of the compiler.
gcc/ada/
* sem_ch3.adb (Constrain_Array): Replace manual list length
computation by call to List_Length.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch3.adb | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index c79d323395f..e92b46fa6f6 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -13809,7 +13809,7 @@ package body Sem_Ch3 is
Suffix : Character)
is
C : constant Node_Id := Constraint (SI);
- Number_Of_Constraints : Nat := 0;
+ Number_Of_Constraints : constant Nat := List_Length (Constraints (C));
Index : Node_Id;
S, T : Entity_Id;
Constraint_OK : Boolean := True;
@@ -13835,12 +13835,6 @@ package body Sem_Ch3 is
Constraint_OK := False;
else
- S := First (Constraints (C));
- while Present (S) loop
- Number_Of_Constraints := Number_Of_Constraints + 1;
- Next (S);
- end loop;
-
-- In either case, the index constraint must provide a discrete
-- range for each index of the array type and the type of each
-- discrete range must be the same as that of the corresponding
--
2.42.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-19 14:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 14:41 [COMMITTED] ada: Seize opportunity to reuse List_Length 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).