Commit 02bb0765 by Arnaud Charlet

[multiple changes]

2014-07-29  Robert Dewar  <dewar@adacore.com>

	* einfo.adb (Has_Protected): Test base type.
	* sem_ch4.adb (Analyze_Allocator): Reorganize code to make sure
	that we always properly check No_Protected_Type_Allocators.

2014-07-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.ads, sem_util.adb (Defining_Entity):	Now applies to
	loop declarations as well.
	* exp_ch5.adb (Expand_Loop_Statement): Apply Qualify_Entity_Names
	to an iterator loop, because it may contain local renaming
	declarations that require debugging information.

2014-07-29  Robert Dewar  <dewar@adacore.com>

	* sem_util.ads, exp_util.adb, sem_attr.adb: Minor reformatting.

From-SVN: r213163
parent fc3a3f3b
2014-07-29 Robert Dewar <dewar@adacore.com> 2014-07-29 Robert Dewar <dewar@adacore.com>
* einfo.adb (Has_Protected): Test base type.
* sem_ch4.adb (Analyze_Allocator): Reorganize code to make sure
that we always properly check No_Protected_Type_Allocators.
2014-07-29 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads, sem_util.adb (Defining_Entity): Now applies to
loop declarations as well.
* exp_ch5.adb (Expand_Loop_Statement): Apply Qualify_Entity_Names
to an iterator loop, because it may contain local renaming
declarations that require debugging information.
2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_util.ads, exp_util.adb, sem_attr.adb: Minor reformatting.
2014-07-29 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb (Static_Real_Or_String_Predicate): New function * einfo.ads, einfo.adb (Static_Real_Or_String_Predicate): New function
(Set_Static_Real_Or_String_Predicate): New procedure (Set_Static_Real_Or_String_Predicate): New procedure
* sem_ch13.adb (Build_Predicate_Functions): Accomodate static * sem_ch13.adb (Build_Predicate_Functions): Accomodate static
......
...@@ -1647,7 +1647,7 @@ package body Einfo is ...@@ -1647,7 +1647,7 @@ package body Einfo is
function Has_Protected (Id : E) return B is function Has_Protected (Id : E) return B is
begin begin
return Flag271 (Id); return Flag271 (Base_Type (Id));
end Has_Protected; end Has_Protected;
function Has_Qualified_Name (Id : E) return B is function Has_Qualified_Name (Id : E) return B is
......
...@@ -3946,6 +3946,19 @@ package body Exp_Ch5 is ...@@ -3946,6 +3946,19 @@ package body Exp_Ch5 is
and then Present (Iterator_Specification (Scheme)) and then Present (Iterator_Specification (Scheme))
then then
Expand_Iterator_Loop (N); Expand_Iterator_Loop (N);
-- An iterator loop may generate renaming declarations for elements
-- that require debug information. This is the case in particular
-- with element iterators, where debug information must be generated
-- for the temporary that holds the element value. These temporaries
-- are created within a transient block whose local declarations are
-- transferred to the loop, which now has non-trivial local objects.
if Nkind (N) = N_Loop_Statement
and then Present (Identifier (N))
then
Qualify_Entity_Names (N);
end if;
end if; end if;
-- When the iteration scheme mentiones attribute 'Loop_Entry, the loop -- When the iteration scheme mentiones attribute 'Loop_Entry, the loop
......
...@@ -5447,6 +5447,8 @@ package body Exp_Util is ...@@ -5447,6 +5447,8 @@ package body Exp_Util is
-- that it is common and reasonable for code to be deleted in -- that it is common and reasonable for code to be deleted in
-- instances for various reasons. -- instances for various reasons.
-- Could we use Is_Statically_Unevaluated here???
if Nkind (Parent (N)) = N_If_Statement then if Nkind (Parent (N)) = N_If_Statement then
declare declare
C : constant Node_Id := Condition (Parent (N)); C : constant Node_Id := Condition (Parent (N));
...@@ -5495,6 +5497,7 @@ package body Exp_Util is ...@@ -5495,6 +5497,7 @@ package body Exp_Util is
declare declare
E : Entity_Id := First_Entity (Defining_Entity (N)); E : Entity_Id := First_Entity (Defining_Entity (N));
begin begin
while Present (E) loop while Present (E) loop
if Ekind (E) = E_Operator then if Ekind (E) = E_Operator then
...@@ -5510,7 +5513,7 @@ package body Exp_Util is ...@@ -5510,7 +5513,7 @@ package body Exp_Util is
elsif Nkind (N) = N_If_Statement then elsif Nkind (N) = N_If_Statement then
Kill_Dead_Code (Then_Statements (N)); Kill_Dead_Code (Then_Statements (N));
Kill_Dead_Code (Elsif_Parts (N)); Kill_Dead_Code (Elsif_Parts (N));
Kill_Dead_Code (Else_Statements (N)); Kill_Dead_Code (Else_Statements (N));
elsif Nkind (N) = N_Loop_Statement then elsif Nkind (N) = N_Loop_Statement then
...@@ -5543,8 +5546,10 @@ package body Exp_Util is ...@@ -5543,8 +5546,10 @@ package body Exp_Util is
procedure Kill_Dead_Code (L : List_Id; Warn : Boolean := False) is procedure Kill_Dead_Code (L : List_Id; Warn : Boolean := False) is
N : Node_Id; N : Node_Id;
W : Boolean; W : Boolean;
begin begin
W := Warn; W := Warn;
if Is_Non_Empty_List (L) then if Is_Non_Empty_List (L) then
N := First (L); N := First (L);
while Present (N) loop while Present (N) loop
...@@ -6770,7 +6775,7 @@ package body Exp_Util is ...@@ -6770,7 +6775,7 @@ package body Exp_Util is
Analyze (Block); Analyze (Block);
end if; end if;
when others => when others =>
null; null;
end case; end case;
end Process_Statements_For_Controlled_Objects; end Process_Statements_For_Controlled_Objects;
...@@ -6782,6 +6787,7 @@ package body Exp_Util is ...@@ -6782,6 +6787,7 @@ package body Exp_Util is
function Power_Of_Two (N : Node_Id) return Nat is function Power_Of_Two (N : Node_Id) return Nat is
Typ : constant Entity_Id := Etype (N); Typ : constant Entity_Id := Etype (N);
pragma Assert (Is_Integer_Type (Typ)); pragma Assert (Is_Integer_Type (Typ));
Siz : constant Nat := UI_To_Int (Esize (Typ)); Siz : constant Nat := UI_To_Int (Esize (Typ));
Val : Uint; Val : Uint;
...@@ -8703,7 +8709,6 @@ package body Exp_Util is ...@@ -8703,7 +8709,6 @@ package body Exp_Util is
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Stseq : constant Node_Id := Handled_Statement_Sequence (N); Stseq : constant Node_Id := Handled_Statement_Sequence (N);
Stmts : constant List_Id := Statements (Stseq); Stmts : constant List_Id := Statements (Stseq);
begin begin
if Abort_Allowed then if Abort_Allowed then
Prepend_To (Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); Prepend_To (Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
......
...@@ -5492,7 +5492,7 @@ package body Sem_Attr is ...@@ -5492,7 +5492,7 @@ package body Sem_Attr is
when Attribute_Scalar_Storage_Order => Scalar_Storage_Order : when Attribute_Scalar_Storage_Order => Scalar_Storage_Order :
declare declare
Ent : Entity_Id := Empty; Ent : Entity_Id := Empty;
begin begin
Check_E0; Check_E0;
...@@ -5505,7 +5505,7 @@ package body Sem_Attr is ...@@ -5505,7 +5505,7 @@ package body Sem_Attr is
-- the default bit order for the target. -- the default bit order for the target.
if not (GNAT_Mode and then Is_Generic_Type (P_Type)) if not (GNAT_Mode and then Is_Generic_Type (P_Type))
and then not In_Instance and then not In_Instance
then then
Error_Attr_P Error_Attr_P
("prefix of % attribute must be record or array type"); ("prefix of % attribute must be record or array type");
......
...@@ -639,15 +639,6 @@ package body Sem_Ch4 is ...@@ -639,15 +639,6 @@ package body Sem_Ch4 is
end; end;
end if; end if;
-- Check restriction against dynamically allocated protected
-- objects. Note that when limited aggregates are supported,
-- a similar test should be applied to an allocator with a
-- qualified expression ???
if Has_Protected (Type_Id) then
Check_Restriction (No_Protected_Type_Allocators, N);
end if;
-- Check for missing initialization. Skip this check if we already -- Check for missing initialization. Skip this check if we already
-- had errors on analyzing the allocator, since in that case these -- had errors on analyzing the allocator, since in that case these
-- are probably cascaded errors. -- are probably cascaded errors.
...@@ -725,6 +716,12 @@ package body Sem_Ch4 is ...@@ -725,6 +716,12 @@ package body Sem_Ch4 is
Check_Restriction (No_Task_Allocators, N); Check_Restriction (No_Task_Allocators, N);
end if; end if;
-- Check restriction against dynamically allocated protected objects
if Has_Protected (Designated_Type (Acc_Type)) then
Check_Restriction (No_Protected_Type_Allocators, N);
end if;
-- AI05-0013-1: No_Nested_Finalization forbids allocators if the access -- AI05-0013-1: No_Nested_Finalization forbids allocators if the access
-- type is nested, and the designated type needs finalization. The rule -- type is nested, and the designated type needs finalization. The rule
-- is conservative in that class-wide types need finalization. -- is conservative in that class-wide types need finalization.
......
...@@ -444,6 +444,11 @@ package Sem_Util is ...@@ -444,6 +444,11 @@ package Sem_Util is
-- specification. If the declaration has a defining unit name, then the -- specification. If the declaration has a defining unit name, then the
-- defining entity is obtained from the defining unit name ignoring any -- defining entity is obtained from the defining unit name ignoring any
-- child unit prefixes. -- child unit prefixes.
--
-- Iterator loops also have a defining entity, which holds the list of
-- local entities declared during loop expansion. These entities need
-- debugging information, generated through QUalify_Entity_Names, and
-- the loop declaration must be placed in the table Name_Qualify_Units.
function Denotes_Discriminant function Denotes_Discriminant
(N : Node_Id; (N : Node_Id;
......
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