https://gcc.gnu.org/g:e7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb

commit r15-262-ge7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Sun Aug 21 20:56:26 2022 +0200

    ada: Remove redundant guard against empty list of actions
    
    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.

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

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;

Reply via email to