Cond : constant Node_Id := Condition (N);
Loc : constant Source_Ptr := Sloc (N);
+ Filter : Node_Id;
Loop_Id : Entity_Id;
QE_Scop : Entity_Id;
if Present (Iterator_Specification (N)) then
Loop_Id := Defining_Identifier (Iterator_Specification (N));
+ Filter := Iterator_Filter (Iterator_Specification (N));
else
Loop_Id := Defining_Identifier (Loop_Parameter_Specification (N));
+ Filter := Iterator_Filter (Loop_Parameter_Specification (N));
end if;
declare
and then not Is_Internal_Name (Chars (Loop_Id))
and then not Has_Junk_Name (Loop_Id)
then
- if Referenced (Loop_Id, Cond) then
+ -- If there is a filter, then it is less clear whether the loop
+ -- variable is used or not; just ignore this case, for simplicity.
+
+ if Present (Filter) then
+ null;
+ elsif Referenced (Loop_Id, Cond) then
Check_Subexpr (Cond, Kind => Full);
elsif not Is_Trivial_Boolean (Cond) then
Error_Msg_N ("?.t?unused variable &", Loop_Id);