diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-06-12 13:02:08 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-06-12 13:02:08 +0200 |
commit | 9b168a8bd3854341c48ad5aa1b30ea5bed06ba9e (patch) | |
tree | 46f25fc3cb83485c5cec509ad4598cfbb0b5bd8d /gcc/ada | |
parent | 7c4d75bfb59458d913c10a3b561b72f85c53dc71 (diff) | |
download | gcc-9b168a8bd3854341c48ad5aa1b30ea5bed06ba9e.zip gcc-9b168a8bd3854341c48ad5aa1b30ea5bed06ba9e.tar.gz gcc-9b168a8bd3854341c48ad5aa1b30ea5bed06ba9e.tar.bz2 |
[multiple changes]
2012-06-12 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Process_Transient_Objects): Renamed constant
Requires_Hooking to Must_Hook and replace all occurrences of the name.
(Requires_Hooking): New routine. Detect all contexts that require
transient variable export to the outer finalizer due to a potential
exception.
2012-06-12 Eric Botcazou <ebotcazou@adacore.com>
* einfo.ads: Minor correction in comment.
From-SVN: r188444
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/einfo.ads | 2 | ||||
-rw-r--r-- | gcc/ada/exp_ch7.adb | 47 |
3 files changed, 51 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ad0181a..d1494f6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2012-06-12 Hristian Kirtchev <kirtchev@adacore.com> + + * exp_ch7.adb (Process_Transient_Objects): Renamed constant + Requires_Hooking to Must_Hook and replace all occurrences of the name. + (Requires_Hooking): New routine. Detect all contexts that require + transient variable export to the outer finalizer due to a potential + exception. + 2012-06-12 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb: Small adjustment. diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 01037a5..c69857a 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -2671,7 +2671,7 @@ package Einfo is -- appropriate external name for use by the linker. -- Is_Protected_Record_Type (synthesized) --- Applies to all entities, true if Is_Concurrent_Record_Type +-- Applies to all entities, true if Is_Concurrent_Record_Type is true and -- Corresponding_Concurrent_Type is a protected type. -- Is_Pure (Flag44) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index f42cb81..e9daade 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -4327,10 +4327,47 @@ package body Exp_Ch7 is Last_Object : Node_Id; Related_Node : Node_Id) is - Requires_Hooking : constant Boolean := - Nkind_In (N, N_Function_Call, - N_Procedure_Call_Statement); + function Requires_Hooking return Boolean; + -- Determine whether the context requires transient variable export + -- to the outer finalizer. This scenario arises when the context may + -- raise an exception. + ---------------------- + -- Requires_Hooking -- + ---------------------- + + function Requires_Hooking return Boolean is + function Is_Subprogram_Call (Nod : Node_Id) return Boolean; + -- Determine whether a particular node is a procedure of function + -- call. + + ------------------------ + -- Is_Subprogram_Call -- + ------------------------ + + function Is_Subprogram_Call (Nod : Node_Id) return Boolean is + begin + return + Nkind_In (Nod, N_Function_Call, N_Procedure_Call_Statement); + end Is_Subprogram_Call; + + -- Start of processing for Requires_Hooking + + begin + -- The context is either a procedure or function call or an object + -- declaration initialized by such a call. In all these cases, the + -- calls are assumed to raise an exception. + + return + Is_Subprogram_Call (N) + or else + (Nkind (N) = N_Object_Declaration + and then Is_Subprogram_Call (Expression (N))); + end Requires_Hooking; + + -- Local variables + + Must_Hook : constant Boolean := Requires_Hooking; Built : Boolean := False; Desig_Typ : Entity_Id; Fin_Block : Node_Id; @@ -4395,7 +4432,7 @@ package body Exp_Ch7 is -- enclosing sequence of statements where their corresponding -- "hooks" are picked up by the finalization machinery. - if Requires_Hooking then + if Must_Hook then declare Expr : Node_Id; Ptr_Id : Entity_Id; @@ -4470,7 +4507,7 @@ package body Exp_Ch7 is -- Generate: -- Temp := null; - if Requires_Hooking then + if Must_Hook then Append_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Reference_To (Temp_Id, Loc), |