diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-17 14:00:46 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-17 14:00:46 +0000 |
commit | 6e415d8b4b81f63c7a24b0d7a384cd5b2ce9809a (patch) | |
tree | 52fd5b0e30aa03f790606a602eb60aea70209bbc /gcc | |
parent | 737e84605477c40d99dc323b14ebd351d161d9f4 (diff) | |
download | gcc-6e415d8b4b81f63c7a24b0d7a384cd5b2ce9809a.tar.gz |
2013-10-17 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb, exp_util.ads (Entity_Of): Moved to Sem_Util.
* sem_prag.adb (Analyze_Global_In_Decl_List): Mark a null
item list as being analyzed.
(Analyze_Global_List): Mark a
null global list and multiple global items as being analyzed.
(Analyze_Input_Item): Check the unit that defines the input
variable or state, not the reference to it.
* sem_util.ads, sem_util.adb (Entity_Of): Moved from Exp_Util. Ensure
that the input has an entity.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 29 | ||||
-rw-r--r-- | gcc/ada/exp_util.ads | 4 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 17 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 29 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 4 |
6 files changed, 54 insertions, 41 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a815f366bc6..f3222709d51 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2013-10-17 Hristian Kirtchev <kirtchev@adacore.com> + + * exp_util.adb, exp_util.ads (Entity_Of): Moved to Sem_Util. + * sem_prag.adb (Analyze_Global_In_Decl_List): Mark a null + item list as being analyzed. + (Analyze_Global_List): Mark a + null global list and multiple global items as being analyzed. + (Analyze_Input_Item): Check the unit that defines the input + variable or state, not the reference to it. + * sem_util.ads, sem_util.adb (Entity_Of): Moved from Exp_Util. Ensure + that the input has an entity. + 2013-10-17 Thomas Quinot <quinot@adacore.com> * exp_util.adb (Get_Current_Value_Condition, diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index c260207550d..a14b1bc1e19 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -1771,35 +1771,6 @@ package body Exp_Util is end if; end Ensure_Defined; - --------------- - -- Entity_Of -- - --------------- - - function Entity_Of (N : Node_Id) return Entity_Id is - Id : Entity_Id; - - begin - Id := Empty; - - if Is_Entity_Name (N) then - Id := Entity (N); - - -- Follow a possible chain of renamings to reach the root renamed - -- object. - - while Present (Renamed_Object (Id)) loop - if Is_Entity_Name (Renamed_Object (Id)) then - Id := Entity (Renamed_Object (Id)); - else - Id := Empty; - exit; - end if; - end loop; - end if; - - return Id; - end Entity_Of; - -------------------- -- Entry_Names_OK -- -------------------- diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index 60a21324ce2..bf72220f826 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -349,10 +349,6 @@ package Exp_Util is -- used to ensure that an Itype is properly defined outside a conditional -- construct when it is referenced in more than one branch. - function Entity_Of (N : Node_Id) return Entity_Id; - -- Return the entity of N or Empty. If N is a renaming, return the entity - -- of the root renamed object. - function Entry_Names_OK return Boolean; -- Determine whether it is appropriate to dynamically allocate strings -- which represent entry [family member] names. These strings are created diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 62aa1b1ea04..507d84ffa51 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -1856,7 +1856,7 @@ package body Sem_Prag is begin if Nkind (List) = N_Null then - null; + Set_Analyzed (List); -- Single global item declaration @@ -1869,6 +1869,7 @@ package body Sem_Prag is -- Simple global list or moded global list declaration elsif Nkind (List) = N_Aggregate then + Set_Analyzed (List); -- The declaration of a simple global list appear as a collection -- of expressions. @@ -1985,7 +1986,7 @@ package body Sem_Prag is -- There is nothing to be done for a null global list if Nkind (Items) = N_Null then - null; + Set_Analyzed (Items); -- Analyze the various forms of global lists and items. Note that some -- of these may be malformed in which case the analysis emits error @@ -2365,7 +2366,7 @@ package body Sem_Prag is -- The input cannot denote states or variables declared -- within the related package. - if In_Same_Code_Unit (Item, Input) then + if In_Same_Code_Unit (Item, Input_Id) then Error_Msg_Name_1 := Chars (Pack_Id); Error_Msg_NE ("input item & cannot denote a visible variable or " @@ -11125,6 +11126,11 @@ package body Sem_Prag is GNAT_Pragma; Check_Arg_Count (1); + -- The pragma is analyzed at the end of the declarative part which + -- contains the related subprogram. Reset the analyzed flag. + + Set_Analyzed (N, False); + -- Ensure the proper placement of the pragma. Contract_Cases must -- be associated with a subprogram declaration or a body that acts -- as a spec. @@ -11140,11 +11146,6 @@ package body Sem_Prag is return; end if; - -- The pragma is analyzed at the end of the declarative part which - -- contains the related subprogram. Reset the analyzed flag. - - Set_Analyzed (N, False); - -- When the pragma appears on a subprogram body, perform the full -- analysis now. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 6e9e7fe464f..08acd702caf 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -4982,6 +4982,35 @@ package body Sem_Util is end if; end Enter_Name; + --------------- + -- Entity_Of -- + --------------- + + function Entity_Of (N : Node_Id) return Entity_Id is + Id : Entity_Id; + + begin + Id := Empty; + + if Is_Entity_Name (N) then + Id := Entity (N); + + -- Follow a possible chain of renamings to reach the root renamed + -- object. + + while Present (Id) and then Present (Renamed_Object (Id)) loop + if Is_Entity_Name (Renamed_Object (Id)) then + Id := Entity (Renamed_Object (Id)); + else + Id := Empty; + exit; + end if; + end loop; + end if; + + return Id; + end Entity_Of; + -------------------------- -- Explain_Limited_Type -- -------------------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index ffaf661523e..8227ee2735b 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -481,6 +481,10 @@ package Sem_Util is -- Note: Enter_Name is not used for overloadable entities, instead these -- are entered using Sem_Ch6.Enter_Overloadable_Entity. + function Entity_Of (N : Node_Id) return Entity_Id; + -- Return the entity of N or Empty. If N is a renaming, return the entity + -- of the root renamed object. + procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id); -- This procedure is called after issuing a message complaining about an -- inappropriate use of limited type T. If useful, it adds additional |