No functional changes.
gcc/ada/ChangeLog:
* exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statement): Merge the
eslif condition with the if condition for cleanup actions.
* sem_ch6.adb (Analyze_Procedure_Call.Analyze_Call_And_Resolve): Get
rid of if statement whose condition is always true.
* sinfo.ads (Finally_Statements): Document their purpose.
-- Add cleanup actions if required. No cleanup actions are needed in
-- thunks associated with interfaces, because they only displace the
- -- pointer to the object. For extended return statements, we need
- -- cleanup actions if the Handled_Statement_Sequence contains generated
- -- objects of controlled types, for example. We do not want to clean up
- -- the return object.
-
- if Nkind (Parent (N)) not in N_Accept_Statement
- | N_Extended_Return_Statement
- | N_Package_Body
- and then not Delay_Cleanups (Current_Scope)
- and then not Is_Thunk (Current_Scope)
- then
- Expand_Cleanup_Actions (Parent (N));
+ -- pointer to the object.
- elsif Nkind (Parent (N)) = N_Extended_Return_Statement
- and then Handled_Statement_Sequence (Parent (N)) = N
+ if Nkind (Parent (N)) not in N_Accept_Statement | N_Package_Body
and then not Delay_Cleanups (Current_Scope)
+ and then not Is_Thunk (Current_Scope)
then
- pragma Assert (not Is_Thunk (Current_Scope));
Expand_Cleanup_Actions (Parent (N));
end if;
+ -- Protect the Finally_Statements with abort defer/undefer
+
if Present (Finally_Statements (N)) and then Abort_Allowed then
if Exceptions_OK then
Set_Finally_Statements
procedure Analyze_Procedure_Call (N : Node_Id) is
procedure Analyze_Call_And_Resolve;
- -- Do Analyze and Resolve calls for procedure call. At the end, check
- -- for illegal order dependence.
- -- ??? where is the check for illegal order dependencies?
+ -- Do Analyze and Resolve for procedure call
------------------------------
-- Analyze_Call_And_Resolve --
procedure Analyze_Call_And_Resolve is
begin
- if Nkind (N) = N_Procedure_Call_Statement then
- Analyze_Call (N);
- Resolve (N, Standard_Void_Type);
- else
- Analyze (N);
- end if;
+ Analyze_Call (N);
+ Resolve (N, Standard_Void_Type);
end Analyze_Call_And_Resolve;
-- Local variables
-- that references the file the external initializer points to.
-- Finally_Statements
- -- Present in N_Handled_Statement_Sequences nodes. Points to a list
- -- containing statements.
+ -- Present in N_Handled_Sequence_Of_Statements nodes. Points to a list
+ -- of statements to be executed on all possible execution paths on exit
+ -- to the sequence of statements.
-- First_Inlined_Subprogram
-- Present in the N_Compilation_Unit node for the main program. Points
-- Statements
-- End_Label (set to Empty if expander generated)
-- Exception_Handlers (set to No_List if none present)
+ -- Finally_Statements (set to No_List if no finally statements)
-- At_End_Proc (set to Empty if no clean up procedure)
- -- Note: A Handled_Sequence_Of_Statements can contain both
- -- Exception_Handlers and an At_End_Proc.
+ -- Note: An N_Handled_Sequence_Of_Statements node can simultaneously
+ -- contain Exception_Handlers, Finally_Statements and an At_End_Proc.
-- Note: the parent always contains a Declarations field which contains
-- declarations associated with the handled sequence of statements. This