From 8cf23b91885b80e1f673cbc4135d01390b65d213 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 31 Aug 2011 11:07:20 +0200 Subject: [multiple changes] 2011-08-31 Robert Dewar * exp_ch5.adb, exp_alfa.ads, prj.ads, sem_attr.adb, lib-xref-alfa.adb: Minor reformatting. 2011-08-31 Matthew Heaney * a-crbltr.ads (Tree_Type): Default-initialize the Nodes component. 2011-08-31 Javier Miranda * sem_ch4.adb (Try_Object_Operation): Addition of one formal to search only for class-wide subprograms conflicting with entities of concurrent tagged types. 2011-08-31 Matthew Heaney * a-rbtgbo.adb (Generic_Allocate): Initialize pointer components of node to null value. 2011-08-31 Hristian Kirtchev * sem_ch12.adb (Insert_Freeze_Node_For_Instance): Provide a more general description of the routine. 2011-08-31 Ed Schonberg * a-cbdlli.adb, a-cbdlli.ads: Add iterator machinery to bounded doubly-linked lists. From-SVN: r178363 --- gcc/ada/sem_ch12.adb | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'gcc/ada/sem_ch12.adb') diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ad6d482..d759def 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -519,19 +519,11 @@ package body Sem_Ch12 is procedure Insert_Freeze_Node_For_Instance (N : Node_Id; F_Node : Node_Id); - -- N is an instance and F_Node is its corresponding freeze node. Insert - -- F_Node depending on the enclosing context and placement of N in the - -- following manner: - -- - -- 1) N is a package instance - Attempt to insert the freeze node before - -- a source package or subprogram body which follows immediately after N. - -- If no such body is found, perform the actions in 2). - -- - -- 2) N is a subprogram instance or a package instance not followed by - -- a source body - Insert the freeze node at the end of the declarations - -- list which contains N. If N is in the visible part of an enclosing - -- package declaration, the freeze node is inserted at the end of the - -- private declarations. + -- N denotes a package or a subprogram instantiation and F_Node is the + -- associated freeze node. Insert the freeze node before the first source + -- body which follows immediately after N. If no such body is found, the + -- freeze node is inserted at the end of the declarative region which + -- contains N. procedure Freeze_Subprogram_Body (Inst_Node : Node_Id; @@ -7586,7 +7578,6 @@ package body Sem_Ch12 is elsif Nkind (Parent (N)) = N_Package_Body and then In_Same_Declarative_Part (Freeze_Node (Par), Parent (N)) then - declare Enclosing : constant Entity_Id := Corresponding_Spec (Parent (N)); @@ -7596,7 +7587,30 @@ package body Sem_Ch12 is Ensure_Freeze_Node (Enclosing); if not Is_List_Member (Freeze_Node (Enclosing)) then - Insert_After (Freeze_Node (Par), Freeze_Node (Enclosing)); + + -- The enclosing context is a subunit, insert the freeze + -- node after the stub. + + if Nkind (Parent (Parent (N))) = N_Subunit then + Insert_Freeze_Node_For_Instance + (Corresponding_Stub (Parent (Parent (N))), + Freeze_Node (Enclosing)); + + -- The parent instance has been frozen before the body of + -- the enclosing package, insert the freeze node after + -- the body. + + elsif List_Containing (Freeze_Node (Par)) = + List_Containing (Parent (N)) + and then Sloc (Freeze_Node (Par)) < Sloc (Parent (N)) + then + Insert_Freeze_Node_For_Instance + (Parent (N), Freeze_Node (Enclosing)); + + else + Insert_After + (Freeze_Node (Par), Freeze_Node (Enclosing)); + end if; end if; end; -- cgit v1.1