From: Eric Botcazou <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch11.adb | 18 ++++--------------
gcc/ada/sem_ch6.adb | 12 +++---------
gcc/ada/sinfo.ads | 10 ++++++----
3 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index a6b17184cb1..71921787955 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -1279,27 +1279,17 @@ package body Exp_Ch11 is
-- 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.
+ -- pointer to the object.
- if Nkind (Parent (N)) not in N_Accept_Statement
- | N_Extended_Return_Statement
- | N_Package_Body
+ 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
Expand_Cleanup_Actions (Parent (N));
-
- elsif Nkind (Parent (N)) = N_Extended_Return_Statement
- and then Handled_Statement_Sequence (Parent (N)) = N
- and then not Delay_Cleanups (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
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 3b7e61ed11e..2e0df1df29e 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1611,9 +1611,7 @@ package body Sem_Ch6 is
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 --
@@ -1621,12 +1619,8 @@ package body Sem_Ch6 is
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
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 34777c01cfb..bd0ef87e9e8 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1274,8 +1274,9 @@ package Sinfo is
-- 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
@@ -6920,10 +6921,11 @@ package Sinfo is
-- 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
--
2.51.0