Commit 9337aa0a by Arnaud Charlet

[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
parent 75ba322d
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> 2009-07-27 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb (Expand_Call): Reset Is_Known_Valid after call * exp_ch6.adb (Expand_Call): Reset Is_Known_Valid after call
......
...@@ -390,9 +390,11 @@ package body Exp_Ch2 is ...@@ -390,9 +390,11 @@ package body Exp_Ch2 is
Write_Str (": Read from scalar """); Write_Str (": Read from scalar """);
Write_Name (Chars (N)); Write_Name (Chars (N));
Write_Str (""""); Write_Str ("""");
if Is_Known_Valid (E) then if Is_Known_Valid (E) then
Write_Str (", Is_Known_Valid"); Write_Str (", Is_Known_Valid");
end if; end if;
Write_Eol; Write_Eol;
end if; end if;
......
...@@ -681,6 +681,11 @@ package body Sem_Ch6 is ...@@ -681,6 +681,11 @@ package body Sem_Ch6 is
end if; end if;
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); Check_References (Stm_Entity);
end; end;
end if; end if;
......
...@@ -5343,7 +5343,6 @@ package body Sem_Util is ...@@ -5343,7 +5343,6 @@ package body Sem_Util is
Call : Node_Id; Call : Node_Id;
begin begin
Find_Actual (N, Formal, Call); Find_Actual (N, Formal, Call);
return Present (Formal) return Present (Formal)
and then Ekind (Formal) = E_Out_Parameter; and then Ekind (Formal) = E_Out_Parameter;
end Is_Actual_Out_Parameter; end Is_Actual_Out_Parameter;
...@@ -6131,6 +6130,10 @@ package body Sem_Util is ...@@ -6131,6 +6130,10 @@ package body Sem_Util is
-- 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 begin
......
...@@ -662,11 +662,10 @@ package Sem_Util is ...@@ -662,11 +662,10 @@ package Sem_Util is
function Is_Dependent_Component_Of_Mutable_Object function Is_Dependent_Component_Of_Mutable_Object
(Object : Node_Id) return Boolean; (Object : Node_Id) return Boolean;
-- Returns True if Object is the name of a subcomponent that -- Returns True if Object is the name of a subcomponent that depends on
-- depends on discriminants of a variable whose nominal subtype -- discriminants of a variable whose nominal subtype is unconstrained and
-- is unconstrained and not indefinite, and the variable is -- not indefinite, and the variable is not aliased. Otherwise returns
-- not aliased. Otherwise returns False. The nodes passed -- False. The nodes passed to this function are assumed to denote objects.
-- to this function are assumed to denote objects.
function Is_Dereferenced (N : Node_Id) return Boolean; function Is_Dereferenced (N : Node_Id) return Boolean;
-- N is a subexpression node of an access type. This function returns -- N is a subexpression node of an access type. This function returns
...@@ -693,14 +692,13 @@ package Sem_Util is ...@@ -693,14 +692,13 @@ package Sem_Util is
-- point type T, i.e. if it is an exact multiple of Small. -- point type T, i.e. if it is an exact multiple of Small.
function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean; function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
-- Typ is a type entity. This function returns true if this type is -- Typ is a type entity. This function returns true if this type is fully
-- fully initialized, meaning that an object of the type is fully -- initialized, meaning that an object of the type is fully initialized.
-- initialized. Note that initialization resulting from the use of -- Note that initialization resulting from use of pragma Normalized_Scalars
-- pragma Normalized_Scalars does not count. Note that this is only -- does not count. Note that this is only used for the purpose of issuing
-- used for the purpose of issuing warnings for objects that are -- warnings for objects that are potentially referenced uninitialized. This
-- potentially referenced uninitialized. This means that the result -- means that the result returned is not crucial, but should err on the
-- returned is not crucial, but probably should err on the side of -- side of thinking things are fully initialized if it does not know.
-- thinking things are fully initialized if it does not know.
function Is_Inherited_Operation (E : Entity_Id) return Boolean; function Is_Inherited_Operation (E : Entity_Id) return Boolean;
-- E is a subprogram. Return True is E is an implicit operation inherited -- E is a subprogram. Return True is E is an implicit operation inherited
...@@ -709,6 +707,9 @@ package Sem_Util is ...@@ -709,6 +707,9 @@ package Sem_Util is
function Is_LHS (N : Node_Id) return Boolean; function Is_LHS (N : Node_Id) return Boolean;
-- Returns True iff N is an identifier used as Name in an assignment -- Returns True iff N is an identifier used as Name in an assignment
-- statement. -- 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; function Is_Library_Level_Entity (E : Entity_Id) return Boolean;
-- A library-level declaration is one that is accessible from Standard, -- A library-level declaration is one that is accessible from Standard,
......
...@@ -3904,7 +3904,6 @@ package body Sem_Warn is ...@@ -3904,7 +3904,6 @@ package body Sem_Warn is
then then
if Warn_On_Modified_Unread if Warn_On_Modified_Unread
and then not Is_Imported (E) and then not Is_Imported (E)
and then not Is_Return_Object (E)
and then not Is_Aliased (E) and then not Is_Aliased (E)
and then No (Renamed_Object (E)) and then No (Renamed_Object (E))
then then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment