[multiple changes]

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
This commit is contained in:
Arnaud Charlet 2009-07-27 15:24:40 +02:00
parent 75ba322d4b
commit 9337aa0a75
6 changed files with 39 additions and 17 deletions

View File

@ -1,3 +1,15 @@
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

View File

@ -384,15 +384,17 @@ package body Exp_Ch2 is
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 ("""");
if Is_Known_Valid (E) then
Write_Str (", Is_Known_Valid");
end if;
Write_Eol;
end if;

View File

@ -681,6 +681,11 @@ package body Sem_Ch6 is
end if;
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;

View File

@ -5343,7 +5343,6 @@ package body Sem_Util is
Call : Node_Id;
begin
Find_Actual (N, Formal, Call);
return Present (Formal)
and then Ekind (Formal) = E_Out_Parameter;
end Is_Actual_Out_Parameter;
@ -6131,8 +6130,12 @@ package body Sem_Util is
-- 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
P : constant Node_Id := Parent (N);
P : constant Node_Id := Parent (N);
begin
return Nkind (P) = N_Assignment_Statement
and then Name (P) = N;

View File

@ -662,11 +662,10 @@ package Sem_Util is
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
@ -693,14 +692,13 @@ package Sem_Util is
-- 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
@ -709,6 +707,9 @@ package Sem_Util is
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,

View File

@ -3904,7 +3904,6 @@ package body Sem_Warn is
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