aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch7.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch7.adb')
-rw-r--r--gcc/ada/exp_ch7.adb45
1 files changed, 22 insertions, 23 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index f5fa9a50d37..713ba58b72b 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -2605,8 +2605,8 @@ package body Exp_Ch7 is
-- procedures of types Init_Typ or Obj_Typ.
function Next_Suitable_Statement (Stmt : Node_Id) return Node_Id;
- -- Given a statement which is part of a list, return the next
- -- statement while skipping over dynamic elab checks.
+ -- Obtain the next statement which follows list member Stmt while
+ -- ignoring artifacts related to access-before-elaboration checks.
-----------------------------
-- Find_Last_Init_In_Block --
@@ -2725,16 +2725,22 @@ package body Exp_Ch7 is
-----------------------------
function Next_Suitable_Statement (Stmt : Node_Id) return Node_Id is
- Result : Node_Id := Next (Stmt);
+ Result : Node_Id;
begin
- -- Skip over access-before-elaboration checks
+ -- Skip call markers and Program_Error raises installed by the
+ -- ABE mechanism.
+
+ Result := Next (Stmt);
+ while Present (Result) loop
+ if not Nkind_In (Result, N_Call_Marker,
+ N_Raise_Program_Error)
+ then
+ exit;
+ end if;
- if Dynamic_Elaboration_Checks
- and then Nkind (Result) = N_Raise_Program_Error
- then
Result := Next (Result);
- end if;
+ end loop;
return Result;
end Next_Suitable_Statement;
@@ -4463,7 +4469,7 @@ package body Exp_Ch7 is
-- This is done only for non-generic packages
if Ekind (Spec_Id) = E_Package then
- Push_Scope (Corresponding_Spec (N));
+ Push_Scope (Spec_Id);
-- Build dispatch tables of library level tagged types
@@ -4475,18 +4481,15 @@ package body Exp_Ch7 is
Build_Task_Activation_Call (N);
- -- When the package is subject to pragma Initial_Condition, the
- -- assertion expression must be verified at the end of the body
- -- statements.
+ -- Verify the run-time semantics of pragma Initial_Condition at the
+ -- end of the body statements.
- if Present (Get_Pragma (Spec_Id, Pragma_Initial_Condition)) then
- Expand_Pragma_Initial_Condition (N);
- end if;
+ Expand_Pragma_Initial_Condition (Spec_Id, N);
Pop_Scope;
end if;
- Set_Elaboration_Flag (N, Corresponding_Spec (N));
+ Set_Elaboration_Flag (N, Spec_Id);
Set_In_Package_Body (Spec_Id, False);
-- Set to encode entity names in package body before gigi is called
@@ -4601,14 +4604,10 @@ package body Exp_Ch7 is
Build_Task_Activation_Call (N);
end if;
- -- When the package is subject to pragma Initial_Condition and lacks
- -- a body, the assertion expression must be verified at the end of
- -- the visible declarations. Otherwise the check is performed at the
- -- end of the body statements (see Expand_N_Package_Body).
+ -- Verify the run-time semantics of pragma Initial_Condition at the
+ -- end of the private declarations when the package lacks a body.
- if Present (Get_Pragma (Id, Pragma_Initial_Condition)) then
- Expand_Pragma_Initial_Condition (N);
- end if;
+ Expand_Pragma_Initial_Condition (Id, N);
Pop_Scope;
end if;