diff mbox series

[COMMITTED] ada: Remove redundant guard against empty list of actions

Message ID 20240507080037.37999-1-poulhies@adacore.com
State New
Headers show
Series [COMMITTED] ada: Remove redundant guard against empty list of actions | expand

Commit Message

Marc Poulhiès May 7, 2024, 8 a.m. UTC
From: Piotr Trojanek <trojanek@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch4.adb | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 5fa47c9b6e7..505c4b3151a 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -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;