]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove redundant protection against empty lists
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 20 Mar 2023 14:47:29 +0000 (15:47 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:21 +0000 (10:23 +0200)
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.

gcc/ada/sem_util.adb

index a42b2dff60f1772041b71714bbef1b10d3c89790..34ea06432cf72441f695461debfd590fba0f9cf9 100644 (file)
@@ -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);