From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [COMMITTED] ada: Use generalized loop iteration in Put_Image routines
Date: Tue, 30 May 2023 09:20:31 +0200 [thread overview]
Message-ID: <20230530072031.2499585-1-poulhies@adacore.com> (raw)
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
reply other threads:[~2023-05-30 7:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230530072031.2499585-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).