Commit c8957aae by Arnaud Charlet

[multiple changes]

2012-05-15  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch9.adb (Expand_N_Asynchronous_Select): Extract the statements
	of the abortable part and triggering alternative after being processed
	for controlled objects.
	(Expand_N_Timed_Entry_Call): Code and comment reformatting.

2012-05-15  Robert Dewar  <dewar@adacore.com>

	* sem_util.adb: Minor code reorganization.

From-SVN: r187520
parent 799d0e05
2012-05-15 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch9.adb (Expand_N_Asynchronous_Select): Extract the statements
of the abortable part and triggering alternative after being processed
for controlled objects.
(Expand_N_Timed_Entry_Call): Code and comment reformatting.
2012-05-15 Robert Dewar <dewar@adacore.com>
* sem_util.adb: Minor code reorganization.
2012-05-15 Robert Dewar <dewar@adacore.com> 2012-05-15 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb, exp_ch11.adb, exp_ch11.ads: Minor reformatting. * exp_ch7.adb, exp_ch11.adb, exp_ch11.ads: Minor reformatting.
......
...@@ -162,6 +162,9 @@ package body Exception_Traces is ...@@ -162,6 +162,9 @@ package body Exception_Traces is
----------------------------------- -----------------------------------
procedure Unhandled_Exception_Terminate is procedure Unhandled_Exception_Terminate is
-- Comments needed on why we do things this way ??? (see RH)
Excep : Exception_Occurrence; Excep : Exception_Occurrence;
-- This occurrence will be used to display a message after finalization. -- This occurrence will be used to display a message after finalization.
-- It is necessary to save a copy here, or else the designated value -- It is necessary to save a copy here, or else the designated value
......
...@@ -6595,15 +6595,14 @@ package body Exp_Ch9 is ...@@ -6595,15 +6595,14 @@ package body Exp_Ch9 is
-- see Expand_N_Entry_Call_Statement. -- see Expand_N_Entry_Call_Statement.
procedure Expand_N_Asynchronous_Select (N : Node_Id) is procedure Expand_N_Asynchronous_Select (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Abrt : constant Node_Id := Abortable_Part (N); Abrt : constant Node_Id := Abortable_Part (N);
Astats : constant List_Id := Statements (Abrt); Trig : constant Node_Id := Triggering_Alternative (N);
Trig : constant Node_Id := Triggering_Alternative (N);
Tstats : constant List_Id := Statements (Trig);
Abort_Block_Ent : Entity_Id; Abort_Block_Ent : Entity_Id;
Abortable_Block : Node_Id; Abortable_Block : Node_Id;
Actuals : List_Id; Actuals : List_Id;
Astats : List_Id;
Blk_Ent : Entity_Id; Blk_Ent : Entity_Id;
Blk_Typ : Entity_Id; Blk_Typ : Entity_Id;
Call : Node_Id; Call : Node_Id;
...@@ -6635,6 +6634,7 @@ package body Exp_Ch9 is ...@@ -6635,6 +6634,7 @@ package body Exp_Ch9 is
Stmt : Node_Id; Stmt : Node_Id;
Stmts : List_Id; Stmts : List_Id;
TaskE_Stmts : List_Id; TaskE_Stmts : List_Id;
Tstats : List_Id;
B : Entity_Id; -- Call status flag B : Entity_Id; -- Call status flag
Bnn : Entity_Id; -- Communication block Bnn : Entity_Id; -- Communication block
...@@ -6648,6 +6648,12 @@ package body Exp_Ch9 is ...@@ -6648,6 +6648,12 @@ package body Exp_Ch9 is
Process_Statements_For_Controlled_Objects (Trig); Process_Statements_For_Controlled_Objects (Trig);
Process_Statements_For_Controlled_Objects (Abrt); Process_Statements_For_Controlled_Objects (Abrt);
-- Retrieve Astats and Tstats now because the finalization machinery may
-- wrap them in blocks.
Astats := Statements (Abrt);
Tstats := Statements (Trig);
Blk_Ent := Make_Temporary (Loc, 'A'); Blk_Ent := Make_Temporary (Loc, 'A');
Ecall := Triggering_Statement (Trig); Ecall := Triggering_Statement (Trig);
...@@ -11881,13 +11887,6 @@ package body Exp_Ch9 is ...@@ -11881,13 +11887,6 @@ package body Exp_Ch9 is
procedure Expand_N_Timed_Entry_Call (N : Node_Id) is procedure Expand_N_Timed_Entry_Call (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
E_Call : Node_Id :=
Entry_Call_Statement (Entry_Call_Alternative (N));
E_Stats : List_Id; -- statements after entry call
D_Stat : Node_Id :=
Delay_Statement (Delay_Alternative (N));
D_Stats : List_Id; -- statements after "delay ..."
Actuals : List_Id; Actuals : List_Id;
Blk_Typ : Entity_Id; Blk_Typ : Entity_Id;
Call : Node_Id; Call : Node_Id;
...@@ -11896,9 +11895,13 @@ package body Exp_Ch9 is ...@@ -11896,9 +11895,13 @@ package body Exp_Ch9 is
Concval : Node_Id; Concval : Node_Id;
D_Conv : Node_Id; D_Conv : Node_Id;
D_Disc : Node_Id; D_Disc : Node_Id;
D_Stat : Node_Id;
D_Stats : List_Id;
D_Type : Entity_Id; D_Type : Entity_Id;
Decls : List_Id; Decls : List_Id;
Dummy : Node_Id; Dummy : Node_Id;
E_Call : Node_Id;
E_Stats : List_Id;
Ename : Node_Id; Ename : Node_Id;
Formals : List_Id; Formals : List_Id;
Index : Node_Id; Index : Node_Id;
...@@ -11928,11 +11931,14 @@ package body Exp_Ch9 is ...@@ -11928,11 +11931,14 @@ package body Exp_Ch9 is
return; return;
end if; end if;
E_Call := Entry_Call_Statement (Entry_Call_Alternative (N));
D_Stat := Delay_Statement (Delay_Alternative (N));
Process_Statements_For_Controlled_Objects (Entry_Call_Alternative (N)); Process_Statements_For_Controlled_Objects (Entry_Call_Alternative (N));
Process_Statements_For_Controlled_Objects (Delay_Alternative (N)); Process_Statements_For_Controlled_Objects (Delay_Alternative (N));
-- Must fetch E_Stats/D_Stats after above "Process_...", because it -- Retrieve E_Stats and D_Stats now because the finalization machinery
-- might modify them. -- may wrap them in blocks.
E_Stats := Statements (Entry_Call_Alternative (N)); E_Stats := Statements (Entry_Call_Alternative (N));
D_Stats := Statements (Delay_Alternative (N)); D_Stats := Statements (Delay_Alternative (N));
......
...@@ -2509,9 +2509,9 @@ package body Sem_Ch6 is ...@@ -2509,9 +2509,9 @@ package body Sem_Ch6 is
-- Previously we scanned the body to look for nested subprograms, and -- Previously we scanned the body to look for nested subprograms, and
-- rejected an inline directive if nested subprograms were present, -- rejected an inline directive if nested subprograms were present,
-- because the back-end would generate conflicting symbols for the -- because the back-end would generate conflicting symbols for the
-- nested bodies. This is now unecessary. -- nested bodies. This is now unnecessary.
-- Look ahead to recognize a pragma inline that appears after the body -- Look ahead to recognize a pragma Inline that appears after the body
Check_Inline_Pragma (Spec_Id); Check_Inline_Pragma (Spec_Id);
......
...@@ -3039,11 +3039,33 @@ package body Sem_Util is ...@@ -3039,11 +3039,33 @@ package body Sem_Util is
and then Is_Entity_Name (Renamed_Object (Id)) and then Is_Entity_Name (Renamed_Object (Id))
then then
return Effective_Extra_Accessibility (Entity (Renamed_Object (Id))); return Effective_Extra_Accessibility (Entity (Renamed_Object (Id)));
else
return Extra_Accessibility (Id);
end if; end if;
return Extra_Accessibility (Id);
end Effective_Extra_Accessibility; end Effective_Extra_Accessibility;
------------------------------
-- Enclosing_Comp_Unit_Node --
------------------------------
function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id is
Current_Node : Node_Id;
begin
Current_Node := N;
while Present (Current_Node)
and then Nkind (Current_Node) /= N_Compilation_Unit
loop
Current_Node := Parent (Current_Node);
end loop;
if Nkind (Current_Node) /= N_Compilation_Unit then
return Empty;
else
return Current_Node;
end if;
end Enclosing_Comp_Unit_Node;
-------------------------- --------------------------
-- Enclosing_CPP_Parent -- -- Enclosing_CPP_Parent --
-------------------------- --------------------------
...@@ -3165,28 +3187,6 @@ package body Sem_Util is ...@@ -3165,28 +3187,6 @@ package body Sem_Util is
return Unit_Entity; return Unit_Entity;
end Enclosing_Lib_Unit_Entity; end Enclosing_Lib_Unit_Entity;
------------------------------
-- Enclosing_Comp_Unit_Node --
------------------------------
function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id is
Current_Node : Node_Id;
begin
Current_Node := N;
while Present (Current_Node)
and then Nkind (Current_Node) /= N_Compilation_Unit
loop
Current_Node := Parent (Current_Node);
end loop;
if Nkind (Current_Node) /= N_Compilation_Unit then
return Empty;
end if;
return Current_Node;
end Enclosing_Comp_Unit_Node;
----------------------- -----------------------
-- Enclosing_Package -- -- Enclosing_Package --
----------------------- -----------------------
......
...@@ -368,6 +368,10 @@ package Sem_Util is ...@@ -368,6 +368,10 @@ package Sem_Util is
-- Same as Einfo.Extra_Accessibility except thtat object renames -- Same as Einfo.Extra_Accessibility except thtat object renames
-- are looked through. -- are looked through.
function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id;
-- Returns the enclosing N_Compilation_Unit Node that is the root of a
-- subtree containing N.
function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id; function Enclosing_CPP_Parent (Typ : Entity_Id) return Entity_Id;
-- Returns the closest ancestor of Typ that is a CPP type. -- Returns the closest ancestor of Typ that is a CPP type.
...@@ -386,10 +390,6 @@ package Sem_Util is ...@@ -386,10 +390,6 @@ package Sem_Util is
-- root of the current scope (which must not be Standard_Standard, and the -- root of the current scope (which must not be Standard_Standard, and the
-- caller is responsible for ensuring this condition). -- caller is responsible for ensuring this condition).
function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id;
-- Returns the enclosing N_Compilation_Unit Node that is the root of a
-- subtree containing N.
function Enclosing_Package (E : Entity_Id) return Entity_Id; function Enclosing_Package (E : Entity_Id) return Entity_Id;
-- Utility function to return the Ada entity of the package enclosing -- Utility function to return the Ada entity of the package enclosing
-- the entity E, if any. Returns Empty if no enclosing package. -- the entity E, if any. Returns Empty if no enclosing package.
......
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