From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [COMMITTED] ada: Remove redundant protection against empty lists
Date: Mon, 29 May 2023 10:29:44 +0200 [thread overview]
Message-ID: <20230529082944.2410880-1-poulhies@adacore.com> (raw)
From: Piotr Trojanek <trojanek@adacore.com>
Calls to First on No_List intentionally return Empty, so explicit guards
against No_List are unnecessary. Code cleanup; semantics is unaffected.
gcc/ada/
* sem_util.adb (Check_Function_Writable_Actuals): Remove guard against
a membership test with no alternatives; simplify with a membership test.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_util.adb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index a42b2dff60f..34ea06432cf 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -2882,9 +2882,7 @@ package body Sem_Util is
Collect_Identifiers (Right_Opnd (N));
end if;
- if Nkind (N) in N_In | N_Not_In
- and then Present (Alternatives (N))
- then
+ if Nkind (N) in N_Membership_Test then
Expr := First (Alternatives (N));
while Present (Expr) loop
Collect_Identifiers (Expr);
--
2.40.0
next reply other threads:[~2023-05-29 8:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 8:29 Marc Poulhiès [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-05-26 7:36 Marc Poulhiès
2023-05-22 8:50 Marc Poulhiès
2023-05-15 9:43 Marc Poulhiès
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=20230529082944.2410880-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).