public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1493] [Ada] Remove redundant protection against empty lists
@ 2022-07-05 8:30 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-05 8:30 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:076a6d13d1e07a72fb964579316920225829777c
commit r13-1493-g076a6d13d1e07a72fb964579316920225829777c
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Wed Jun 8 16:58:18 2022 +0200
[Ada] Remove redundant protection against empty lists
Calls to First on No_List intentionally return Empty node, so explicit
guards against No_List are unnecessary. Code cleanup; semantics is
unaffected.
gcc/ada/
* exp_code.adb (Setup_Asm_IO_Args): Remove guard against No_List.
* par_sco.adb (Process_Decisions): Likewise.
* sem_ch13.adb (Check_Component_List): Likewise.
* sem_ch6.adb (FCL): Likewise.
Diff:
---
gcc/ada/exp_code.adb | 6 +-----
gcc/ada/par_sco.adb | 12 +++++-------
gcc/ada/sem_ch13.adb | 32 +++++++++++++++-----------------
gcc/ada/sem_ch6.adb | 13 ++-----------
4 files changed, 23 insertions(+), 40 deletions(-)
diff --git a/gcc/ada/exp_code.adb b/gcc/ada/exp_code.adb
index 11fbc5fc29d..d144b489f2f 100644
--- a/gcc/ada/exp_code.adb
+++ b/gcc/ada/exp_code.adb
@@ -471,11 +471,7 @@ package body Exp_Code is
-- Case of list of arguments
elsif Nkind (Arg) = N_Aggregate then
- if Expressions (Arg) = No_List then
- Operand_Var := Empty;
- else
- Operand_Var := First (Expressions (Arg));
- end if;
+ Operand_Var := First (Expressions (Arg));
-- Otherwise must be default (no operands) case
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index aba863dfeb2..e8875cf28b4 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -480,13 +480,11 @@ package body Par_SCO is
N : Node_Id;
begin
- if L /= No_List then
- N := First (L);
- while Present (N) loop
- Process_Decisions (N, T, Pragma_Sloc);
- Next (N);
- end loop;
- end if;
+ N := First (L);
+ while Present (N) loop
+ Process_Decisions (N, T, Pragma_Sloc);
+ Next (N);
+ end loop;
end Process_Decisions;
-- Version taking a node
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 27f32504999..bb654abe412 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -12135,24 +12135,22 @@ package body Sem_Ch13 is
begin
-- Gather discriminants into Comp
- if DS /= No_List then
- Citem := First (DS);
- while Present (Citem) loop
- if Nkind (Citem) = N_Discriminant_Specification then
- declare
- Ent : constant Entity_Id :=
- Defining_Identifier (Citem);
- begin
- if Ekind (Ent) = E_Discriminant then
- Ncomps := Ncomps + 1;
- Comps (Ncomps) := Ent;
- end if;
- end;
- end if;
+ Citem := First (DS);
+ while Present (Citem) loop
+ if Nkind (Citem) = N_Discriminant_Specification then
+ declare
+ Ent : constant Entity_Id :=
+ Defining_Identifier (Citem);
+ begin
+ if Ekind (Ent) = E_Discriminant then
+ Ncomps := Ncomps + 1;
+ Comps (Ncomps) := Ent;
+ end if;
+ end;
+ end if;
- Next (Citem);
- end loop;
- end if;
+ Next (Citem);
+ end loop;
-- Gather component entities into Comp
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index e5c13ed36b2..440770ad8bf 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -9988,17 +9988,8 @@ package body Sem_Ch6 is
N2 : Node_Id;
begin
- if L1 = No_List then
- N1 := Empty;
- else
- N1 := First (L1);
- end if;
-
- if L2 = No_List then
- N2 := Empty;
- else
- N2 := First (L2);
- end if;
+ N1 := First (L1);
+ N2 := First (L2);
-- Compare two lists, skipping rewrite insertions (we want to compare
-- the original trees, not the expanded versions).
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-05 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 8:30 [gcc r13-1493] [Ada] Remove redundant protection against empty lists Pierre-Marie de Rodat
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).