]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Use generalized loop iteration in Put_Image routines
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 10 Apr 2023 08:12:13 +0000 (10:12 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:16 +0000 (09:12 +0200)
gcc/ada/

* libgnat/a-cidlli.adb (Put_Image): Simplify.
* libgnat/a-coinve.adb (Put_Image): Likewise.

gcc/ada/libgnat/a-cidlli.adb
gcc/ada/libgnat/a-coinve.adb

index 65582d152f03f146ba007d034a8c8a020ceb5059..9e6ad70a103b84954ac0ba943d2e85a84ca2d20e 100644 (file)
@@ -1283,22 +1283,19 @@ is
    is
       First_Time : Boolean := True;
       use System.Put_Images;
+   begin
+      Array_Before (S);
 
-      procedure Put_Elem (Position : Cursor);
-      procedure Put_Elem (Position : Cursor) is
-      begin
+      for X of V loop
          if First_Time then
             First_Time := False;
          else
             Simple_Array_Between (S);
          end if;
 
-         Element_Type'Put_Image (S, Element (Position));
-      end Put_Elem;
+         Element_Type'Put_Image (S, X);
+      end loop;
 
-   begin
-      Array_Before (S);
-      Iterate (V, Put_Elem'Access);
       Array_After (S);
    end Put_Image;
 
index 846f819a7321c1c19c43f2cf304af7e403e00792..dd0e8cdee4091488edaad9ba08aca5caf217e032 100644 (file)
@@ -2679,22 +2679,19 @@ is
    is
       First_Time : Boolean := True;
       use System.Put_Images;
+   begin
+      Array_Before (S);
 
-      procedure Put_Elem (Position : Cursor);
-      procedure Put_Elem (Position : Cursor) is
-      begin
+      for X of V loop
          if First_Time then
             First_Time := False;
          else
             Simple_Array_Between (S);
          end if;
 
-         Element_Type'Put_Image (S, Element (Position));
-      end Put_Elem;
+         Element_Type'Put_Image (S, X);
+      end loop;
 
-   begin
-      Array_Before (S);
-      Iterate (V, Put_Elem'Access);
       Array_After (S);
    end Put_Image;