diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2023-09-29 11:25:18 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-10-19 16:35:21 +0200 |
commit | 0c29a990a645e24d48bf06adb7e1dca104b79335 (patch) | |
tree | c63ebc680c06dc81b44e012165d69c7594fb8cff /gcc/ada/sem_ch3.adb | |
parent | 7b1b787baa6ecc03a62b0db043a856cdb6463146 (diff) | |
download | gcc-0c29a990a645e24d48bf06adb7e1dca104b79335.zip gcc-0c29a990a645e24d48bf06adb7e1dca104b79335.tar.gz gcc-0c29a990a645e24d48bf06adb7e1dca104b79335.tar.bz2 |
ada: Seize opportunity to reuse List_Length
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.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index c79d323..e92b46f 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 |