2009-07-27 Gary Dismukes <dismukes@adacore.com>
* sem_ch6.adb (Analyze_Function_Return): Set Referenced on return
objects, since these are implicitly referenced by the return statement.
* sem_warn.adb (Warn_On_Unreferenced_Entity): No longer a need to test
Is_Return_Object in this procedure, as return objects will never make
it here since they're now marked as Referenced.
2009-07-27 Robert Dewar <dewar@adacore.com>
* exp_ch2.adb, sem_util.adb, sem_util.ads: Minor reformnatting
From-SVN: r150111
+2009-07-27 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Analyze_Function_Return): Set Referenced on return
+ objects, since these are implicitly referenced by the return statement.
+ * sem_warn.adb (Warn_On_Unreferenced_Entity): No longer a need to test
+ Is_Return_Object in this procedure, as return objects will never make
+ it here since they're now marked as Referenced.
+
+2009-07-27 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch2.adb, sem_util.adb, sem_util.ads: Minor reformnatting
+
2009-07-27 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb (Expand_Call): Reset Is_Known_Valid after call
2009-07-27 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb (Expand_Call): Reset Is_Known_Valid after call
and then not Is_LHS (N)
and then not Is_Actual_Out_Parameter (N)
and then (Nkind (Parent (N)) /= N_Attribute_Reference
and then not Is_LHS (N)
and then not Is_Actual_Out_Parameter (N)
and then (Nkind (Parent (N)) /= N_Attribute_Reference
- or else Attribute_Name (Parent (N)) /= Name_Valid)
+ or else Attribute_Name (Parent (N)) /= Name_Valid)
then
Write_Location (Sloc (N));
Write_Str (": Read from scalar """);
Write_Name (Chars (N));
Write_Str ("""");
then
Write_Location (Sloc (N));
Write_Str (": Read from scalar """);
Write_Name (Chars (N));
Write_Str ("""");
if Is_Known_Valid (E) then
Write_Str (", Is_Known_Valid");
end if;
if Is_Known_Valid (E) then
Write_Str (", Is_Known_Valid");
end if;
+ -- Mark the return object as referenced, since the return is an
+ -- implicit reference of the object.
+
+ Set_Referenced (Defining_Identifier (Obj_Decl));
+
Check_References (Stm_Entity);
end;
end if;
Check_References (Stm_Entity);
end;
end if;
Call : Node_Id;
begin
Find_Actual (N, Formal, Call);
Call : Node_Id;
begin
Find_Actual (N, Formal, Call);
return Present (Formal)
and then Ekind (Formal) = E_Out_Parameter;
end Is_Actual_Out_Parameter;
return Present (Formal)
and then Ekind (Formal) = E_Out_Parameter;
end Is_Actual_Out_Parameter;
-- Is_LHS --
------------
-- Is_LHS --
------------
+ -- We seem to have a lot of overlapping functions that do similar things
+ -- (testing for left hand sides or lvalues???). Anyway, since this one is
+ -- purely syntactic, it should be in Sem_Aux I would think???
+
function Is_LHS (N : Node_Id) return Boolean is
function Is_LHS (N : Node_Id) return Boolean is
- P : constant Node_Id := Parent (N);
+ P : constant Node_Id := Parent (N);
begin
return Nkind (P) = N_Assignment_Statement
and then Name (P) = N;
begin
return Nkind (P) = N_Assignment_Statement
and then Name (P) = N;
function Is_Dependent_Component_Of_Mutable_Object
(Object : Node_Id) return Boolean;
function Is_Dependent_Component_Of_Mutable_Object
(Object : Node_Id) return Boolean;
- -- Returns True if Object is the name of a subcomponent that
- -- depends on discriminants of a variable whose nominal subtype
- -- is unconstrained and not indefinite, and the variable is
- -- not aliased. Otherwise returns False. The nodes passed
- -- to this function are assumed to denote objects.
+ -- Returns True if Object is the name of a subcomponent that depends on
+ -- discriminants of a variable whose nominal subtype is unconstrained and
+ -- not indefinite, and the variable is not aliased. Otherwise returns
+ -- False. The nodes passed to this function are assumed to denote objects.
function Is_Dereferenced (N : Node_Id) return Boolean;
-- N is a subexpression node of an access type. This function returns
function Is_Dereferenced (N : Node_Id) return Boolean;
-- N is a subexpression node of an access type. This function returns
-- point type T, i.e. if it is an exact multiple of Small.
function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
-- point type T, i.e. if it is an exact multiple of Small.
function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
- -- Typ is a type entity. This function returns true if this type is
- -- fully initialized, meaning that an object of the type is fully
- -- initialized. Note that initialization resulting from the use of
- -- pragma Normalized_Scalars does not count. Note that this is only
- -- used for the purpose of issuing warnings for objects that are
- -- potentially referenced uninitialized. This means that the result
- -- returned is not crucial, but probably should err on the side of
- -- thinking things are fully initialized if it does not know.
+ -- Typ is a type entity. This function returns true if this type is fully
+ -- initialized, meaning that an object of the type is fully initialized.
+ -- Note that initialization resulting from use of pragma Normalized_Scalars
+ -- does not count. Note that this is only used for the purpose of issuing
+ -- warnings for objects that are potentially referenced uninitialized. This
+ -- means that the result returned is not crucial, but should err on the
+ -- side of thinking things are fully initialized if it does not know.
function Is_Inherited_Operation (E : Entity_Id) return Boolean;
-- E is a subprogram. Return True is E is an implicit operation inherited
function Is_Inherited_Operation (E : Entity_Id) return Boolean;
-- E is a subprogram. Return True is E is an implicit operation inherited
function Is_LHS (N : Node_Id) return Boolean;
-- Returns True iff N is an identifier used as Name in an assignment
-- statement.
function Is_LHS (N : Node_Id) return Boolean;
-- Returns True iff N is an identifier used as Name in an assignment
-- statement.
+ -- Which is true, the spec or the body???
+ -- The body does not restrict N to be an identifier, it can be any
+ -- expression on the left side of an assignment ???
function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
-- A library-level declaration is one that is accessible from Standard,
function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
-- A library-level declaration is one that is accessible from Standard,
then
if Warn_On_Modified_Unread
and then not Is_Imported (E)
then
if Warn_On_Modified_Unread
and then not Is_Imported (E)
- and then not Is_Return_Object (E)
and then not Is_Aliased (E)
and then No (Renamed_Object (E))
then
and then not Is_Aliased (E)
and then No (Renamed_Object (E))
then