aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-06-08 16:58:18 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-05 08:28:20 +0000
commit076a6d13d1e07a72fb964579316920225829777c (patch)
tree77592e603295aaa3437d7b203759ec6f3f55eedc
parent5709fac357bb922a9eeecf42adbedd532c00fde6 (diff)
downloadgcc-076a6d13d1e07a72fb964579316920225829777c.zip
gcc-076a6d13d1e07a72fb964579316920225829777c.tar.gz
gcc-076a6d13d1e07a72fb964579316920225829777c.tar.bz2
[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.
-rw-r--r--gcc/ada/exp_code.adb6
-rw-r--r--gcc/ada/par_sco.adb12
-rw-r--r--gcc/ada/sem_ch13.adb32
-rw-r--r--gcc/ada/sem_ch6.adb13
4 files changed, 23 insertions, 40 deletions
diff --git a/gcc/ada/exp_code.adb b/gcc/ada/exp_code.adb
index 11fbc5f..d144b48 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 aba863d..e8875cf 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 27f3250..bb654ab 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 e5c13ed..440770a 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).