From 4f87ded359716679d2b3c6225e7569ff4cb4b76f Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Wed, 29 Apr 2009 09:51:28 +0000 Subject: [PATCH] exp_ch7.adb (Build_Final_List): If the designated type is a Taft Amendment type... 2009-04-29 Ed Schonberg * exp_ch7.adb (Build_Final_List): If the designated type is a Taft Amendment type, add the with_clause for Finalization.List_Controller only if the current context is a package body. From-SVN: r146939 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/exp_ch7.adb | 3 +++ 2 files changed, 9 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 43a1075c656..3b40ca63a4a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2009-04-29 Ed Schonberg + + * exp_ch7.adb (Build_Final_List): If the designated type is a Taft + Amendment type, add the with_clause for Finalization.List_Controller + only if the current context is a package body. + 2009-04-29 Thomas Quinot * sem_ch12.adb: Minor reformatting diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 145b55dec72..03f0909e7cb 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -444,6 +444,7 @@ package body Exp_Ch7 is if Has_Completion_In_Body (Directly_Designated_Type (Typ)) and then In_Package_Body (Current_Scope) + and then Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Body and then Nkind (Parent (Declaration_Node (Typ))) = N_Package_Specification then @@ -454,6 +455,8 @@ package body Exp_Ch7 is -- (see exp_ch3.adb). The reference to RE_List_Controller may have -- added a with_clause to the current body. Formally the spec needs -- the with_clause as well, so we add it now, for use by Codepeer. + -- We verify that we are within a package body, because this code + -- can also be invoked within a package instantiation. declare Loc : constant Source_Ptr := Sloc (Typ); -- 2.30.2