From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [COMMITTED] ada: Use procedural variant of Next_Index where possible
Date: Thu, 25 May 2023 10:06:24 +0200 [thread overview]
Message-ID: <20230525080624.1957802-1-poulhies@adacore.com> (raw)
From: Piotr Trojanek <trojanek@adacore.com>
Code cleanup; semantics is unaffected.
gcc/ada/
* einfo-utils.adb (Write_Entity_Info): Use procedural Next_Index.
* sem_aggr.adb (Collect_Aggr_Bounds): Reuse local constant.
(Resolve_Null_Array_Aggregate): Use procedural Next_Index.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/einfo-utils.adb | 2 +-
gcc/ada/sem_aggr.adb | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
index fa28a9e0100..d1db66ff697 100644
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -3171,7 +3171,7 @@ package body Einfo.Utils is
Index := First_Index (Id);
while Present (Index) loop
Write_Attribute (" ", Etype (Index));
- Index := Next_Index (Index);
+ Next_Index (Index);
end loop;
Write_Eol;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 33c44c42a24..d9520ca8f4b 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -464,8 +464,8 @@ package body Sem_Aggr is
This_Range : constant Node_Id := Aggregate_Bounds (N);
-- The aggregate range node of this specific sub-aggregate
- This_Low : constant Node_Id := Low_Bound (Aggregate_Bounds (N));
- This_High : constant Node_Id := High_Bound (Aggregate_Bounds (N));
+ This_Low : constant Node_Id := Low_Bound (This_Range);
+ This_High : constant Node_Id := High_Bound (This_Range);
-- The aggregate bounds of this specific sub-aggregate
Assoc : Node_Id;
@@ -4175,7 +4175,7 @@ package body Sem_Aggr is
Append (Make_Range (Loc, New_Copy_Tree (Lo), Hi), Constr);
Analyze_And_Resolve (Last (Constr), Etype (Index));
- Index := Next_Index (Index);
+ Next_Index (Index);
end loop;
Set_Compile_Time_Known_Aggregate (N);
--
2.40.0
reply other threads:[~2023-05-25 8:06 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=20230525080624.1957802-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=trojanek@adacore.com \
/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).