aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch9.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch9.adb')
-rw-r--r--gcc/ada/exp_ch9.adb38
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index df4a083..68f1290 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -7712,7 +7712,7 @@ package body Exp_Ch9 is
-- or else K = Ada.Tags.TK_Tagged
-- then
-- <dispatching-call>;
- -- <triggering-statements>
+ -- -- <triggering-statements> (code factorized after if-stmt)
-- else
-- S :=
@@ -7737,11 +7737,14 @@ package body Exp_Ch9 is
-- <dispatching-call>;
-- end if;
- -- <triggering-statements>
+ -- -- <triggering-statements> (code factorized after if-stmt)
-- else
-- <else-statements>
+ -- goto L0; -- skip triggering statements
-- end if;
-- end if;
+ -- <triggering-statements>
+ -- L0:
-- end;
procedure Expand_N_Conditional_Entry_Call (N : Node_Id) is
@@ -7757,6 +7760,8 @@ package body Exp_Ch9 is
Decl : Node_Id;
Decls : List_Id;
Formals : List_Id;
+ Label : Node_Id;
+ Label_Id : Entity_Id := Empty;
Lim_Typ_Stmts : List_Id;
N_Stats : List_Id;
Obj : Entity_Id;
@@ -7883,12 +7888,13 @@ package body Exp_Ch9 is
-- then
-- <dispatching-call>
-- end if;
- -- <normal-statements>
+ -- -- <triggering-stataments> (code factorized after if-stmt)
-- else
-- <else-statements>
+ -- goto L0; -- skip triggering statements
-- end if;
- N_Stats := New_Copy_Separate_List (Statements (Alt));
+ N_Stats := New_List;
Prepend_To (N_Stats,
Make_Implicit_If_Statement (N,
@@ -7922,6 +7928,14 @@ package body Exp_Ch9 is
Then_Statements =>
New_List (Blk)));
+ Label_Id := Make_Identifier (Loc, New_External_Name ('L', 0));
+ Set_Entity (Label_Id,
+ Make_Defining_Identifier (Loc, Chars (Label_Id)));
+
+ Append_To (Else_Statements (N),
+ Make_Goto_Statement (Loc,
+ Name => New_Occurrence_Of (Entity (Label_Id), Loc)));
+
Append_To (Conc_Typ_Stmts,
Make_Implicit_If_Statement (N,
Condition => New_Occurrence_Of (B, Loc),
@@ -7930,15 +7944,14 @@ package body Exp_Ch9 is
-- Generate:
-- <dispatching-call>;
- -- <triggering-statements>
+ -- -- <triggering-statements> (code factorized after if-stmt)
- Lim_Typ_Stmts := New_Copy_Separate_List (Statements (Alt));
- Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (Blk));
+ Lim_Typ_Stmts := New_List (New_Copy_Tree (Blk));
-- Generate:
-- if K = Ada.Tags.TK_Limited_Tagged
-- or else K = Ada.Tags.TK_Tagged
- -- then
+ -- then
-- Lim_Typ_Stmts
-- else
-- Conc_Typ_Stmts
@@ -7950,6 +7963,15 @@ package body Exp_Ch9 is
Then_Statements => Lim_Typ_Stmts,
Else_Statements => Conc_Typ_Stmts));
+ Label := Make_Label (Loc, Label_Id);
+ Append_To (Decls,
+ Make_Implicit_Label_Declaration (Loc,
+ Defining_Identifier => Entity (Label_Id),
+ Label_Construct => Label));
+
+ Append_List_To (Stmts, Statements (Alt)); -- triggering-statements
+ Append_To (Stmts, Label);
+
Rewrite (N,
Make_Block_Statement (Loc,
Declarations =>