]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove redundant guard against empty list of actions
authorPiotr Trojanek <trojanek@adacore.com>
Sun, 21 Aug 2022 18:56:26 +0000 (20:56 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 May 2024 07:55:57 +0000 (09:55 +0200)
Code cleanup.

gcc/ada/

* exp_ch4.adb (Useful): Remove redundant check for empty list,
because iteration with First works also for empty list; rename
local variable from L to Action.

gcc/ada/exp_ch4.adb

index 5fa47c9b6e79ed005ee8ed9b7106c5e5788b0142..505c4b3151ad9393459c19181383cb712a8d866f 100644 (file)
@@ -12930,8 +12930,7 @@ package body Exp_Ch4 is
       --  to Opnd /= Shortcut_Value.
 
       function Useful (Actions : List_Id) return Boolean;
-      --  Return True if Actions is not empty and contains useful nodes to
-      --  process.
+      --  Return True if Actions contains useful nodes to process
 
       --------------------
       -- Make_Test_Expr --
@@ -12951,22 +12950,20 @@ package body Exp_Ch4 is
       ------------
 
       function Useful (Actions : List_Id) return Boolean is
-         L : Node_Id;
+         Action : Node_Id;
       begin
-         if Present (Actions) then
-            L := First (Actions);
+         Action := First (Actions);
 
-            --  For now "useful" means not N_Variable_Reference_Marker.
-            --  Consider stripping other nodes in the future.
+         --  For now "useful" means not N_Variable_Reference_Marker. Consider
+         --  stripping other nodes in the future.
 
-            while Present (L) loop
-               if Nkind (L) /= N_Variable_Reference_Marker then
-                  return True;
-               end if;
+         while Present (Action) loop
+            if Nkind (Action) /= N_Variable_Reference_Marker then
+               return True;
+            end if;
 
-               Next (L);
-            end loop;
-         end if;
+            Next (Action);
+         end loop;
 
          return False;
       end Useful;