aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-08-21 20:56:26 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-05-07 09:55:57 +0200
commite7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb (patch)
tree2542b4328d489c8598dad8c0c284f04d58787ef7 /gcc/ada/exp_ch4.adb
parent36ddd8c0988164e2299f1de57866931386e4ceea (diff)
downloadgcc-e7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb.zip
gcc-e7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb.tar.gz
gcc-e7c7bf30cdc04e73ecc34cfb2d955d1316a0e3eb.tar.bz2
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.
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb25
1 files changed, 11 insertions, 14 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 5fa47c9..505c4b3 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;