From: Arnaud Charlet Date: Mon, 27 Jul 2009 13:24:40 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9337aa0a75d5543b376718d8de61cb2120e9b767;p=gcc.git [multiple changes] 2009-07-27 Gary Dismukes * 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 * exp_ch2.adb, sem_util.adb, sem_util.ads: Minor reformnatting From-SVN: r150111 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8185d034751..db01fc49e18 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2009-07-27 Gary Dismukes + + * 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 + + * exp_ch2.adb, sem_util.adb, sem_util.ads: Minor reformnatting + 2009-07-27 Robert Dewar * exp_ch6.adb (Expand_Call): Reset Is_Known_Valid after call diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb index 9d475e2ca6a..e0be4042f11 100644 --- a/gcc/ada/exp_ch2.adb +++ b/gcc/ada/exp_ch2.adb @@ -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; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 7d4bcd15211..daefd11e4ac 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 11abc976d2c..1786b51cee4 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 4948c51845d..5906d98677b 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -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, diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index e580f474820..e917ccf7327 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -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