Commit c364d9be by Javier Miranda Committed by Arnaud Charlet

exp_ch7.adb (Make_Clean): Code cleanup using the new centralized subprogram…

exp_ch7.adb (Make_Clean): Code cleanup using the new centralized subprogram Corresponding_Runtime_Package...

2008-03-26  Javier Miranda  <miranda@adacore.com>

	* exp_ch7.adb (Make_Clean): Code cleanup using the new centralized
	subprogram Corresponding_Runtime_Package to know the runtime package
	that will provide support to a given protected type.

	* exp_ch9.adb (Add_Private_Declarations,
	Build_Protected_Subprogram_Call,
	Build_Protected_Entry, Build_Simple_Entry_Call,
	Expand_N_Protected_Body, Expand_N_Protected_Type_Declaration,
	Expand_N_Timed_Entry_Call, Make_Initialize_Protection): Code
	cleanup using the new centralized subprogram Corresponding_Runtime
	Package to know the runtime package that provides support to
	a given protected type.

From-SVN: r133565
parent 1923d2d6
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -2301,14 +2301,16 @@ package body Exp_Ch7 is
if Nkind (Specification (N)) = N_Procedure_Specification
and then Has_Entries (Pid)
then
if Abort_Allowed
or else Restriction_Active (No_Entry_Queue) = False
or else Number_Entries (Pid) > 1
then
Name := New_Reference_To (RTE (RE_Service_Entries), Loc);
else
Name := New_Reference_To (RTE (RE_Service_Entry), Loc);
end if;
case Corresponding_Runtime_Package (Pid) is
when System_Tasking_Protected_Objects_Entries =>
Name := New_Reference_To (RTE (RE_Service_Entries), Loc);
when System_Tasking_Protected_Objects_Single_Entry =>
Name := New_Reference_To (RTE (RE_Service_Entry), Loc);
when others =>
raise Program_Error;
end case;
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
......@@ -2329,31 +2331,19 @@ package body Exp_Ch7 is
-- object is the record used to implement the protected object.
-- It is a parameter to the protected subprogram.
-- If the protected object is controlled (i.e it has entries or
-- needs finalization for interrupt handling), call
-- Unlock_Entries, except if the protected object follows the
-- ravenscar profile, in which case call Unlock_Entry, otherwise
-- call the simplified version, Unlock.
if Has_Entries (Pid)
or else Has_Interrupt_Handler (Pid)
or else (Has_Attach_Handler (Pid)
and then not Restricted_Profile)
or else (Ada_Version >= Ada_05
and then Present (Interface_List (Parent (Pid))))
then
if Abort_Allowed
or else Restriction_Active (No_Entry_Queue) = False
or else Number_Entries (Pid) > 1
then
case Corresponding_Runtime_Package (Pid) is
when System_Tasking_Protected_Objects_Entries =>
Name := New_Reference_To (RTE (RE_Unlock_Entries), Loc);
else
when System_Tasking_Protected_Objects_Single_Entry =>
Name := New_Reference_To (RTE (RE_Unlock_Entry), Loc);
end if;
else
Name := New_Reference_To (RTE (RE_Unlock), Loc);
end if;
when System_Tasking_Protected_Objects =>
Name := New_Reference_To (RTE (RE_Unlock), Loc);
when others =>
raise Program_Error;
end case;
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
......
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