Commit 1486a00e by Arnaud Charlet

[multiple changes]

2013-04-11  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb (Process_Transient_Object): Add new
	local variable Fin_Call. Remove and explain ??? comment. Use the
	Actions of logical operators "and then" and "or else" to insert
	the generated finalization call.

2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat_rm.texi: Fix typo.

2013-04-11  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb: Minor reformatting.

From-SVN: r197767
parent fc142f63
2013-04-11 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Process_Transient_Object): Add new
local variable Fin_Call. Remove and explain ??? comment. Use the
Actions of logical operators "and then" and "or else" to insert
the generated finalization call.
2013-04-11 Eric Botcazou <ebotcazou@adacore.com>
* gnat_rm.texi: Fix typo.
2013-04-11 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb: Minor reformatting.
2013-04-11 Robert Dewar <dewar@adacore.com>
* atree.h: Add declarations for Flag255-Flag289 Fix declaration
......
......@@ -5166,8 +5166,8 @@ package body Exp_Ch4 is
if Nkind_In (Par, N_Assignment_Statement,
N_Object_Declaration,
N_Pragma,
N_Simple_Return_Statement,
N_Procedure_Call_Statement)
N_Procedure_Call_Statement,
N_Simple_Return_Statement)
then
return Par;
......@@ -5192,6 +5192,7 @@ package body Exp_Ch4 is
Obj_Typ : constant Node_Id := Etype (Obj_Id);
Desig_Typ : Entity_Id;
Expr : Node_Id;
Fin_Call : Node_Id;
Ptr_Id : Entity_Id;
Temp_Id : Entity_Id;
......@@ -5244,9 +5245,12 @@ package body Exp_Ch4 is
-- Step 3: Hook the transient object to the temporary
if Is_Access_Type (Obj_Typ) then
-- The use of unchecked conversion / unrestricted access is needed
-- to avoid an accessibility violation. Note that the finalization
-- code is structured in such a way that the "hook" is processed
-- only when it points to an existing object.
-- Why is this an unchecked conversion ???
if Is_Access_Type (Obj_Typ) then
Expr :=
Unchecked_Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc));
else
......@@ -5282,7 +5286,7 @@ package body Exp_Ch4 is
-- the return statement as this would make it unreachable.
if Nkind (Context) /= N_Simple_Return_Statement then
Insert_Action_After (Context,
Fin_Call :=
Make_Implicit_If_Statement (Obj_Decl,
Condition =>
Make_Op_Ne (Loc,
......@@ -5298,7 +5302,17 @@ package body Exp_Ch4 is
Make_Assignment_Statement (Loc,
Name => New_Reference_To (Temp_Id, Loc),
Expression => Make_Null (Loc)))));
Expression => Make_Null (Loc))));
-- Use the Actions list of logical operators when inserting the
-- finalization call. This ensures that all transient objects
-- are finalized after the operators are evaluated.
if Nkind_In (Context, N_And_Then, N_Or_Else) then
Insert_Action (Context, Fin_Call);
else
Insert_Action_After (Context, Fin_Call);
end if;
end if;
end Process_Transient_Object;
......
......@@ -4032,7 +4032,7 @@ earlier versions of the package body.
Syntax:
@smallexample @c ada
pragma No_Inline (NAME [, NAME]);
pragma No_Inline (NAME {, NAME});
@end smallexample
@noindent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment