[multiple changes]
2014-07-29 Robert Dewar <dewar@adacore.com> * errout.adb: Minor reformatting. 2014-07-29 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch3.adb (Default_Initialize_Object): Add new variables Abrt_Blk and Dummy. Generate a dummy temporary when aborts are not allowed to ensure the symmetrical generation of symbols. * exp_ch7.adb (Build_Object_Declarations): Remove variables A_Expr and E_Decl. Add new variables Decl and Dummy. Generate a dummy temporary when aborts are not allowed to ensure symmertrical generation of symbols. * exp_intr.adb (Expand_Unc_Deallocation): Add new variable Dummy. Generate a dummy temporary when aborts are not allowed to ensure symmertrical generation of symbols. 2014-07-29 Ed Schonberg <schonberg@adacore.com> * exp_dbug.adb (Debug_Renaming_Declaration): For an object renaming, indicate that the renamed entity itself needs debug information. This is necessary if that entity is a temporary, e.g. part of the expansion of an explicit dereference in an iterator. From-SVN: r213157
This commit is contained in:
parent
414c65636f
commit
e2bc5465d6
@ -1,3 +1,28 @@
|
|||||||
|
2014-07-29 Robert Dewar <dewar@adacore.com>
|
||||||
|
|
||||||
|
* errout.adb: Minor reformatting.
|
||||||
|
|
||||||
|
2014-07-29 Hristian Kirtchev <kirtchev@adacore.com>
|
||||||
|
|
||||||
|
* exp_ch3.adb (Default_Initialize_Object): Add new variables
|
||||||
|
Abrt_Blk and Dummy. Generate a dummy temporary when aborts are
|
||||||
|
not allowed to ensure the symmetrical generation of symbols.
|
||||||
|
* exp_ch7.adb (Build_Object_Declarations): Remove variables A_Expr
|
||||||
|
and E_Decl. Add new variables Decl and Dummy. Generate a dummy
|
||||||
|
temporary when aborts are not allowed to ensure symmertrical
|
||||||
|
generation of symbols.
|
||||||
|
* exp_intr.adb (Expand_Unc_Deallocation): Add new variable
|
||||||
|
Dummy. Generate a dummy temporary when aborts are not allowed
|
||||||
|
to ensure symmertrical generation of symbols.
|
||||||
|
|
||||||
|
2014-07-29 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
|
* exp_dbug.adb (Debug_Renaming_Declaration): For an object
|
||||||
|
renaming, indicate that the renamed entity itself needs debug
|
||||||
|
information. This is necessary if that entity is a temporary,
|
||||||
|
e.g. part of the expansion of an explicit dereference in an
|
||||||
|
iterator.
|
||||||
|
|
||||||
2014-07-29 Thomas Quinot <quinot@adacore.com>
|
2014-07-29 Thomas Quinot <quinot@adacore.com>
|
||||||
|
|
||||||
* errout.adb (Set_Error_Posted): When propagating flag to
|
* errout.adb (Set_Error_Posted): When propagating flag to
|
||||||
|
@ -3008,12 +3008,11 @@ package body Errout is
|
|||||||
exit when Nkind (P) not in N_Subexpr;
|
exit when Nkind (P) not in N_Subexpr;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
if Nkind_In (P,
|
if Nkind_In (P, N_Pragma_Argument_Association,
|
||||||
N_Pragma_Argument_Association,
|
N_Component_Association,
|
||||||
N_Component_Association,
|
N_Discriminant_Association,
|
||||||
N_Discriminant_Association,
|
N_Generic_Association,
|
||||||
N_Generic_Association,
|
N_Parameter_Association)
|
||||||
N_Parameter_Association)
|
|
||||||
then
|
then
|
||||||
Set_Error_Posted (Parent (P));
|
Set_Error_Posted (Parent (P));
|
||||||
end if;
|
end if;
|
||||||
|
@ -5031,6 +5031,7 @@ package body Exp_Ch3 is
|
|||||||
|
|
||||||
-- Local variables
|
-- Local variables
|
||||||
|
|
||||||
|
Abrt_Blk : Node_Id;
|
||||||
Abrt_HSS : Node_Id;
|
Abrt_HSS : Node_Id;
|
||||||
Abrt_Id : Entity_Id;
|
Abrt_Id : Entity_Id;
|
||||||
Abrt_Stmts : List_Id;
|
Abrt_Stmts : List_Id;
|
||||||
@ -5041,6 +5042,11 @@ package body Exp_Ch3 is
|
|||||||
Obj_Init : Node_Id := Empty;
|
Obj_Init : Node_Id := Empty;
|
||||||
Obj_Ref : Node_Id;
|
Obj_Ref : Node_Id;
|
||||||
|
|
||||||
|
Dummy : Entity_Id;
|
||||||
|
pragma Unreferenced (Dummy);
|
||||||
|
-- This variable captures an unused dummy internal entity, see the
|
||||||
|
-- comment associated with its use.
|
||||||
|
|
||||||
-- Start of processing for Default_Initialize_Object
|
-- Start of processing for Default_Initialize_Object
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -5205,47 +5211,53 @@ package body Exp_Ch3 is
|
|||||||
|
|
||||||
-- Step 3b: Build the abort block (if applicable)
|
-- Step 3b: Build the abort block (if applicable)
|
||||||
|
|
||||||
-- The abort block is required when aborts are allowed and there is
|
-- The abort block is required when aborts are allowed in order to
|
||||||
-- at least one initialization call that needs protection.
|
-- protect both initialization calls.
|
||||||
|
|
||||||
if Abort_Allowed
|
if Present (Comp_Init) and then Present (Obj_Init) then
|
||||||
and then Present (Comp_Init)
|
if Abort_Allowed then
|
||||||
and then Present (Obj_Init)
|
|
||||||
then
|
|
||||||
-- Generate:
|
|
||||||
-- Abort_Defer;
|
|
||||||
|
|
||||||
Prepend_To (Fin_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
|
-- Generate:
|
||||||
|
-- Abort_Defer;
|
||||||
|
|
||||||
-- Generate:
|
Prepend_To
|
||||||
-- begin
|
(Fin_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
|
||||||
-- Abort_Defer;
|
|
||||||
-- <finalization statements>
|
|
||||||
-- at end
|
|
||||||
-- Abort_Undefer_Direct;
|
|
||||||
-- end;
|
|
||||||
|
|
||||||
Abrt_Id := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
|
-- Generate:
|
||||||
Set_Etype (Abrt_Id, Standard_Void_Type);
|
-- begin
|
||||||
Set_Scope (Abrt_Id, Current_Scope);
|
-- Abort_Defer;
|
||||||
|
-- <finalization statements>
|
||||||
|
-- at end
|
||||||
|
-- Abort_Undefer_Direct;
|
||||||
|
-- end;
|
||||||
|
|
||||||
Abrt_HSS :=
|
Abrt_HSS :=
|
||||||
Make_Handled_Sequence_Of_Statements (Loc,
|
Make_Handled_Sequence_Of_Statements (Loc,
|
||||||
Statements => Fin_Stmts,
|
Statements => Fin_Stmts,
|
||||||
At_End_Proc =>
|
At_End_Proc =>
|
||||||
New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
|
New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
|
||||||
|
|
||||||
Abrt_Stmts := New_List (
|
Abrt_Blk :=
|
||||||
Make_Block_Statement (Loc,
|
Make_Block_Statement (Loc,
|
||||||
Identifier => New_Occurrence_Of (Abrt_Id, Loc),
|
Declarations => No_List,
|
||||||
Declarations => No_List,
|
Handled_Statement_Sequence => Abrt_HSS);
|
||||||
Handled_Statement_Sequence => Abrt_HSS));
|
|
||||||
|
|
||||||
Expand_At_End_Handler (Abrt_HSS, Abrt_Id);
|
Add_Block_Identifier (Abrt_Blk, Abrt_Id);
|
||||||
|
Expand_At_End_Handler (Abrt_HSS, Abrt_Id);
|
||||||
|
|
||||||
-- Abort is not required, the construct from Step 3a is to be added
|
Abrt_Stmts := New_List (Abrt_Blk);
|
||||||
-- in the tree (either finalization block or single initialization
|
|
||||||
-- call).
|
-- Abort is not required
|
||||||
|
|
||||||
|
else
|
||||||
|
-- Generate a dummy entity to ensure that the internal symbols
|
||||||
|
-- are in sync when a unit is compiled with and without aborts.
|
||||||
|
|
||||||
|
Dummy := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
|
||||||
|
Abrt_Stmts := Fin_Stmts;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
-- No initialization calls present
|
||||||
|
|
||||||
else
|
else
|
||||||
Abrt_Stmts := Fin_Stmts;
|
Abrt_Stmts := Fin_Stmts;
|
||||||
|
@ -3134,8 +3134,12 @@ package body Exp_Ch7 is
|
|||||||
Loc : Source_Ptr;
|
Loc : Source_Ptr;
|
||||||
For_Package : Boolean := False)
|
For_Package : Boolean := False)
|
||||||
is
|
is
|
||||||
A_Expr : Node_Id;
|
Decl : Node_Id;
|
||||||
E_Decl : Node_Id;
|
|
||||||
|
Dummy : Entity_Id;
|
||||||
|
pragma Unreferenced (Dummy);
|
||||||
|
-- This variable captures an unused dummy internal entity, see the
|
||||||
|
-- comment associated with its use.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
pragma Assert (Decls /= No_List);
|
pragma Assert (Decls /= No_List);
|
||||||
@ -3164,56 +3168,61 @@ package body Exp_Ch7 is
|
|||||||
-- does not include routine Raise_From_Controlled_Operation which is the
|
-- does not include routine Raise_From_Controlled_Operation which is the
|
||||||
-- the sole user of flag Abort.
|
-- the sole user of flag Abort.
|
||||||
|
|
||||||
-- This is not needed for library-level finalizers as they are called
|
-- This is not needed for library-level finalizers as they are called by
|
||||||
-- by the environment task and cannot be aborted.
|
-- the environment task and cannot be aborted.
|
||||||
|
|
||||||
if Abort_Allowed
|
if VM_Target = No_VM and then not For_Package then
|
||||||
and then VM_Target = No_VM
|
if Abort_Allowed then
|
||||||
and then not For_Package
|
Data.Abort_Id := Make_Temporary (Loc, 'A');
|
||||||
then
|
|
||||||
Data.Abort_Id := Make_Temporary (Loc, 'A');
|
|
||||||
|
|
||||||
A_Expr := New_Occurrence_Of (RTE (RE_Triggered_By_Abort), Loc);
|
-- Generate:
|
||||||
|
-- Abort_Id : constant Boolean := <A_Expr>;
|
||||||
|
|
||||||
-- Generate:
|
Append_To (Decls,
|
||||||
|
Make_Object_Declaration (Loc,
|
||||||
|
Defining_Identifier => Data.Abort_Id,
|
||||||
|
Constant_Present => True,
|
||||||
|
Object_Definition =>
|
||||||
|
New_Occurrence_Of (Standard_Boolean, Loc),
|
||||||
|
Expression =>
|
||||||
|
New_Occurrence_Of (RTE (RE_Triggered_By_Abort), Loc)));
|
||||||
|
|
||||||
-- Abort_Id : constant Boolean := <A_Expr>;
|
-- Abort is not required
|
||||||
|
|
||||||
Append_To (Decls,
|
else
|
||||||
Make_Object_Declaration (Loc,
|
-- Generate a dummy entity to ensure that the internal symbols are
|
||||||
Defining_Identifier => Data.Abort_Id,
|
-- in sync when a unit is compiled with and without aborts.
|
||||||
Constant_Present => True,
|
|
||||||
Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc),
|
Dummy := Make_Temporary (Loc, 'A');
|
||||||
Expression => A_Expr));
|
Data.Abort_Id := Empty;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
-- .NET/JVM or library-level finalizers
|
||||||
|
|
||||||
else
|
else
|
||||||
-- No abort, .NET/JVM or library-level finalizers
|
Data.Abort_Id := Empty;
|
||||||
|
|
||||||
Data.Abort_Id := Empty;
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if Exception_Extra_Info then
|
if Exception_Extra_Info then
|
||||||
Data.E_Id := Make_Temporary (Loc, 'E');
|
Data.E_Id := Make_Temporary (Loc, 'E');
|
||||||
|
|
||||||
-- Generate:
|
-- Generate:
|
||||||
|
|
||||||
-- E_Id : Exception_Occurrence;
|
-- E_Id : Exception_Occurrence;
|
||||||
|
|
||||||
E_Decl :=
|
Decl :=
|
||||||
Make_Object_Declaration (Loc,
|
Make_Object_Declaration (Loc,
|
||||||
Defining_Identifier => Data.E_Id,
|
Defining_Identifier => Data.E_Id,
|
||||||
Object_Definition =>
|
Object_Definition =>
|
||||||
New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc));
|
New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc));
|
||||||
Set_No_Initialization (E_Decl);
|
Set_No_Initialization (Decl);
|
||||||
|
|
||||||
Append_To (Decls, E_Decl);
|
Append_To (Decls, Decl);
|
||||||
|
|
||||||
else
|
else
|
||||||
Data.E_Id := Empty;
|
Data.E_Id := Empty;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- Generate:
|
-- Generate:
|
||||||
|
|
||||||
-- Raised_Id : Boolean := False;
|
-- Raised_Id : Boolean := False;
|
||||||
|
|
||||||
Append_To (Decls,
|
Append_To (Decls,
|
||||||
|
@ -479,6 +479,13 @@ package body Exp_Dbug is
|
|||||||
|
|
||||||
Set_Debug_Info_Needed (Obj);
|
Set_Debug_Info_Needed (Obj);
|
||||||
|
|
||||||
|
-- The renamed entity may be a temporary, e.g. the result of an
|
||||||
|
-- implicit dereference in an iterator. Indicate that the temporary
|
||||||
|
-- itself requires debug information. If the renamed entity comes
|
||||||
|
-- from source this is a no-op.
|
||||||
|
|
||||||
|
Set_Debug_Info_Needed (Entity (Ren));
|
||||||
|
|
||||||
-- Mark the object as internal so that it won't be initialized when
|
-- Mark the object as internal so that it won't be initialized when
|
||||||
-- pragma Initialize_Scalars or Normalize_Scalars is in use.
|
-- pragma Initialize_Scalars or Normalize_Scalars is in use.
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- --
|
-- --
|
||||||
-- B o d y --
|
-- B o d y --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
|
||||||
-- --
|
-- --
|
||||||
-- GNAT is free software; you can redistribute it and/or modify it under --
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
||||||
-- terms of the GNU General Public License as published by the Free Soft- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
@ -914,6 +914,7 @@ package body Exp_Intr is
|
|||||||
Finalizer_Data : Finalization_Exception_Data;
|
Finalizer_Data : Finalization_Exception_Data;
|
||||||
|
|
||||||
Blk : Node_Id := Empty;
|
Blk : Node_Id := Empty;
|
||||||
|
Blk_Id : Entity_Id;
|
||||||
Deref : Node_Id;
|
Deref : Node_Id;
|
||||||
Final_Code : List_Id;
|
Final_Code : List_Id;
|
||||||
Free_Arg : Node_Id;
|
Free_Arg : Node_Id;
|
||||||
@ -926,6 +927,11 @@ package body Exp_Intr is
|
|||||||
-- that we analyze some generated statements before properly attaching
|
-- that we analyze some generated statements before properly attaching
|
||||||
-- them to the tree, and that can disturb current value settings.
|
-- them to the tree, and that can disturb current value settings.
|
||||||
|
|
||||||
|
Dummy : Entity_Id;
|
||||||
|
pragma Unreferenced (Dummy);
|
||||||
|
-- This variable captures an unused dummy internal entity, see the
|
||||||
|
-- comment associated with its use.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
-- Nothing to do if we know the argument is null
|
-- Nothing to do if we know the argument is null
|
||||||
|
|
||||||
@ -1007,8 +1013,7 @@ package body Exp_Intr is
|
|||||||
-- protected by an abort defer/undefer pair.
|
-- protected by an abort defer/undefer pair.
|
||||||
|
|
||||||
if Abort_Allowed then
|
if Abort_Allowed then
|
||||||
Prepend_To (Final_Code,
|
Prepend_To (Final_Code, Build_Runtime_Call (Loc, RE_Abort_Defer));
|
||||||
Build_Runtime_Call (Loc, RE_Abort_Defer));
|
|
||||||
|
|
||||||
Blk :=
|
Blk :=
|
||||||
Make_Block_Statement (Loc, Handled_Statement_Sequence =>
|
Make_Block_Statement (Loc, Handled_Statement_Sequence =>
|
||||||
@ -1016,9 +1021,15 @@ package body Exp_Intr is
|
|||||||
Statements => Final_Code,
|
Statements => Final_Code,
|
||||||
At_End_Proc =>
|
At_End_Proc =>
|
||||||
New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc)));
|
New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc)));
|
||||||
|
Add_Block_Identifier (Blk, Blk_Id);
|
||||||
|
|
||||||
Append (Blk, Stmts);
|
Append (Blk, Stmts);
|
||||||
|
|
||||||
else
|
else
|
||||||
|
-- Generate a dummy entity to ensure that the internal symbols are
|
||||||
|
-- in sync when a unit is compiled with and without aborts.
|
||||||
|
|
||||||
|
Dummy := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
|
||||||
Append_List_To (Stmts, Final_Code);
|
Append_List_To (Stmts, Final_Code);
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
Loading…
Reference in New Issue
Block a user