public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Use generalized loop iteration in Put_Image routines
@ 2023-05-30  7:20 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-30  7:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

From: Eric Botcazou <ebotcazou@adacore.com>

gcc/ada/

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

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnat/a-cidlli.adb | 13 +++++--------
 gcc/ada/libgnat/a-coinve.adb | 13 +++++--------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/gcc/ada/libgnat/a-cidlli.adb b/gcc/ada/libgnat/a-cidlli.adb
index 65582d152f0..9e6ad70a103 100644
--- a/gcc/ada/libgnat/a-cidlli.adb
+++ b/gcc/ada/libgnat/a-cidlli.adb
@@ -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;
 
diff --git a/gcc/ada/libgnat/a-coinve.adb b/gcc/ada/libgnat/a-coinve.adb
index 846f819a732..dd0e8cdee40 100644
--- a/gcc/ada/libgnat/a-coinve.adb
+++ b/gcc/ada/libgnat/a-coinve.adb
@@ -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;
 
-- 
2.40.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-30  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  7:20 [COMMITTED] ada: Use generalized loop iteration in Put_Image routines 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).