aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-01-11 00:16:18 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-15 11:36:42 +0200
commit1f068a17811a89035e43894686b333e9070f45ef (patch)
tree899f6b596aa07f6c3b150073ece31b9a4cf61024 /gcc/ada
parent78de6f03ca32159dec176c47af7caca6c6c996a1 (diff)
downloadgcc-1f068a17811a89035e43894686b333e9070f45ef.zip
gcc-1f068a17811a89035e43894686b333e9070f45ef.tar.gz
gcc-1f068a17811a89035e43894686b333e9070f45ef.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/ * sem_util.adb (New_Copy_Tree): Remove redundant calls to Present.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_util.adb15
1 files changed, 6 insertions, 9 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 5ec0140..eb0d08a1 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -24167,14 +24167,12 @@ package body Sem_Util is
-- Note that the element of a syntactic list is always a node, never
-- an entity or itype, hence the call to Visit_Node.
- if Present (List) then
- Elmt := First (List);
- while Present (Elmt) loop
- Visit_Node (Elmt);
+ Elmt := First (List);
+ while Present (Elmt) loop
+ Visit_Node (Elmt);
- Next (Elmt);
- end loop;
- end if;
+ Next (Elmt);
+ end loop;
end Visit_List;
----------------
@@ -24206,8 +24204,7 @@ package body Sem_Util is
-- If the node is a block, we need to process all declarations
-- in the block and make new entities for each.
- if Nkind (N) = N_Block_Statement and then Present (Declarations (N))
- then
+ if Nkind (N) = N_Block_Statement then
declare
Decl : Node_Id := First (Declarations (N));