diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-27 16:52:29 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-27 16:52:29 +0000 |
commit | 3c9851e9c8e2913859171354644e3ca4062e34c8 (patch) | |
tree | e5e8e81614a2a9517430d8c729e77035019f2b70 /gcc/ada/exp_ch9.adb | |
parent | bc230080977ace4d57cf46ff2a4d4495e5d99e83 (diff) | |
download | gcc-3c9851e9c8e2913859171354644e3ca4062e34c8.tar.gz |
2014-01-27 Robert Dewar <dewar@adacore.com>
* scn.adb (Check_End_Of_Line): Removed.
(Error_Long_Line): Removed.
(Determine_License): Use versions of above routines from Scanner.
* scng.adb (Check_End_Of_Line): Moved to spec.
(Error_Long_Line): Removed, no longer used.
* scng.ads (Check_End_Of_Line): Moved here from body.
2014-01-27 Tristan Gingold <gingold@adacore.com>
* exp_ch7.adb (Build_Cleanup_Statements): Call
Build_Protected_Subprogram_Call_Cleanup to insert the cleanup
for protected body.
* exp_ch9.adb (Build_Protected_Subprogram_Body): Likewise.
Remove Service_Name variable.
(Build_Protected_SUbprogam_Call_Cleanup): New procedure that
factorize code from the above subprograms.
* exp_ch9.ads (Build_Protected_Subprogram_Call_Cleanup): New procedure.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207143 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch9.adb')
-rw-r--r-- | gcc/ada/exp_ch9.adb | 104 |
1 files changed, 86 insertions, 18 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 6adf7b384f4..96a09279ce4 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -4150,7 +4150,6 @@ package body Exp_Ch9 is Sub_Body : Node_Id; Lock_Name : Node_Id; Lock_Stmt : Node_Id; - Service_Name : Node_Id; R : Node_Id; Return_Stmt : Node_Id := Empty; -- init to avoid gcc 3 warning Pre_Stmts : List_Id := No_List; -- init to avoid gcc 3 warning @@ -4235,15 +4234,12 @@ package body Exp_Ch9 is case Corresponding_Runtime_Package (Pid) is when System_Tasking_Protected_Objects_Entries => Lock_Name := New_Reference_To (RTE (RE_Lock_Entries), Loc); - Service_Name := New_Reference_To (RTE (RE_Service_Entries), Loc); when System_Tasking_Protected_Objects_Single_Entry => Lock_Name := New_Reference_To (RTE (RE_Lock_Entry), Loc); - Service_Name := New_Reference_To (RTE (RE_Service_Entry), Loc); when System_Tasking_Protected_Objects => Lock_Name := New_Reference_To (RTE (Lock_Kind), Loc); - Service_Name := New_Reference_To (RTE (RE_Unlock), Loc); when others => raise Program_Error; @@ -4282,20 +4278,7 @@ package body Exp_Ch9 is Append (Unprot_Call, Stmts); end if; - Append ( - Make_Procedure_Call_Statement (Loc, - Name => Service_Name, - Parameter_Associations => - New_List (New_Copy_Tree (Object_Parm))), - Stmts); - - if Abort_Allowed then - Append ( - Make_Procedure_Call_Statement (Loc, - Name => New_Reference_To (RTE (RE_Abort_Undefer), Loc), - Parameter_Associations => Empty_List), - Stmts); - end if; + Build_Protected_Subprogram_Call_Cleanup (Op_Spec, Pid, Loc, Stmts); if Nkind (Op_Spec) = N_Function_Specification then Append (Return_Stmt, Stmts); @@ -4388,6 +4371,91 @@ package body Exp_Ch9 is end if; end Build_Protected_Subprogram_Call; + --------------------------------------------- + -- Build_Protected_Subprogram_Call_Cleanup -- + --------------------------------------------- + + procedure Build_Protected_Subprogram_Call_Cleanup + (Op_Spec : Node_Id; + Conc_Typ : Node_Id; + Loc : Source_Ptr; + Stmts : List_Id) + is + Nam : Node_Id; + + begin + -- If the associated protected object has entries, a protected + -- procedure has to service entry queues. In this case generate: + + -- Service_Entries (_object._object'Access); + + if Nkind (Op_Spec) = N_Procedure_Specification + and then Has_Entries (Conc_Typ) + then + case Corresponding_Runtime_Package (Conc_Typ) is + when System_Tasking_Protected_Objects_Entries => + Nam := New_Reference_To (RTE (RE_Service_Entries), Loc); + + when System_Tasking_Protected_Objects_Single_Entry => + Nam := New_Reference_To (RTE (RE_Service_Entry), Loc); + + when others => + raise Program_Error; + end case; + + Append_To (Stmts, + Make_Procedure_Call_Statement (Loc, + Name => Nam, + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uObject), + Selector_Name => Make_Identifier (Loc, Name_uObject)), + Attribute_Name => Name_Unchecked_Access)))); + + else + -- Generate: + -- Unlock (_object._object'Access); + + case Corresponding_Runtime_Package (Conc_Typ) is + when System_Tasking_Protected_Objects_Entries => + Nam := New_Reference_To (RTE (RE_Unlock_Entries), Loc); + + when System_Tasking_Protected_Objects_Single_Entry => + Nam := New_Reference_To (RTE (RE_Unlock_Entry), Loc); + + when System_Tasking_Protected_Objects => + Nam := New_Reference_To (RTE (RE_Unlock), Loc); + + when others => + raise Program_Error; + end case; + + Append_To (Stmts, + Make_Procedure_Call_Statement (Loc, + Name => Nam, + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, + Prefix => + Make_Selected_Component (Loc, + Prefix => Make_Identifier (Loc, Name_uObject), + Selector_Name => Make_Identifier (Loc, Name_uObject)), + Attribute_Name => Name_Unchecked_Access)))); + end if; + + -- Generate: + -- Abort_Undefer; + + if Abort_Allowed then + Append_To (Stmts, + Make_Procedure_Call_Statement (Loc, + Name => + New_Reference_To (RTE (RE_Abort_Undefer), Loc), + Parameter_Associations => Empty_List)); + end if; + end Build_Protected_Subprogram_Call_Cleanup; + ------------------------- -- Build_Selected_Name -- ------------------------- |