-- end loop;
-- end if;
- -- ...
+ -- . . .
-- if Sn'Length /= 0 then
-- P := Sn'First;
-- Cnn := else-expr
-- end if;
- -- and replace the conditional expression by a reference to Cnn.
+ -- and replace the conditional expression by a reference to Cnn
if Present (Then_Actions (N)) or else Present (Else_Actions (N)) then
Cnn := Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
-- was necessary, but it cleans up the code to do it all the time.
if Is_Access_Type (T) then
- Rewrite (P,
- Make_Explicit_Dereference (Sloc (N),
- Prefix => Relocate_Node (P)));
+ Insert_Explicit_Dereference (P);
Analyze_And_Resolve (P, Designated_Type (T));
end if;
-- Obj1 : Enclosing_UU_Type;
-- Obj2 : Enclosing_UU_Type (1);
- -- . . . Obj1 = Obj2 . . .
+ -- [. . .] Obj1 = Obj2 [. . .]
-- Generated code:
-- ityp (x)
- -- with the Float_Truncate flag set. This is clearly more efficient.
+ -- with the Float_Truncate flag set. This is clearly more efficient
if Nkind (Operand) = N_Attribute_Reference
and then Attribute_Name (Operand) = Name_Truncation
begin
Get_Unit_Name_String (Unit_Name_Id);
- -- Remove seven last character (" (spec)" or " (body)").
+ -- Remove seven last character (" (spec)" or " (body)")
Name_Len := Name_Len - 7;
pragma Assert (Name_Buffer (Name_Len + 1) = ' ');
procedure Insert_Explicit_Dereference (N : Node_Id) is
New_Prefix : constant Node_Id := Relocate_Node (N);
+ Ent : Entity_Id := Empty;
I : Interp_Index;
It : Interp;
T : Entity_Id;
end loop;
End_Interp_List;
+
+ else
+ -- Prefix is unambiguous: mark the original prefix (which might
+ -- Come_From_Source) as a reference, since the new (relocated) one
+ -- won't be taken into account.
+
+ if Is_Entity_Name (New_Prefix) then
+ Ent := Entity (New_Prefix);
+ elsif Nkind (New_Prefix) = N_Selected_Component then
+ Ent := Entity (Selector_Name (New_Prefix));
+ end if;
+
+ if Present (Ent) then
+ Generate_Reference (Ent, New_Prefix);
+ end if;
end if;
end Insert_Explicit_Dereference;
(Ekind (E) = E_Function
or else Ekind (E) = E_Package_Body
or else Ekind (E) = E_Procedure
+ or else Ekind (E) = E_Subprogram_Body
or else Ekind (E) = E_Block)))
-- Exclude instantiations, since there is no reason why
Unreferenced_Entities.Increment_Last;
Unreferenced_Entities.Table (Unreferenced_Entities.Last) := E1;
- -- Force warning on entity.
+ -- Force warning on entity
Set_Referenced (E1, False);
end if;
Un : constant Node_Id := Sinfo.Unit (Cnode);
function Check_Use_Clause (N : Node_Id) return Traverse_Result;
- -- If N is a use_clause for Pack, emit warning.
+ -- If N is a use_clause for Pack, emit warning
procedure Check_Use_Clauses is new
Traverse_Proc (Check_Use_Clause);
if Warn_On_Modified_Unread
and then not Is_Imported (E)
- -- Suppress the message for aliased, renamed
- -- and access variables since there may be
- -- other entities that read the memory location.
+ -- Suppress the message for aliased or renamed
+ -- variables, since there may be other entities
+ -- read the same memory location.
and then not Is_Aliased (E)
and then No (Renamed_Object (E))
- and then not (Is_Access_Type (Etype (E))
- or else
- -- Case of private access type, must examine the
- -- full view due to visibility issues.
-
- (Is_Private_Type (Etype (E))
- and then
- Is_Access_Type
- (Full_View (Etype (E)))))
then
Error_Msg_N
("variable & is assigned but never read?", E);