From e24af32b0f010e2cf37d36ec10f7be02d594df05 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 22 May 2015 13:04:01 +0000 Subject: [PATCH] 2015-05-22 Ed Schonberg * sem_ch10.adb (Analyze_With_Clause): In ASIS_Mode, a limited_with clause on a predefined unit is not transformed into a regular with_clause, to preserve the original tree structure. * sinfo.ads (N_With_Clause): Add comment on handling of Limited_With. * sem_ch10.adb: Minor reformatting. 2015-05-22 Ed Schonberg * sem_ch8.adb (Freeze_Profile): A limited view of a type in the profile of a subprogram renaming does not require freezing, because it is declared in a different unit. 2015-05-22 Ed Schonberg * exp_aggr.adb (Get_Constraint_Association): If type (of ancestor composite type) is private, go to full view. This was previously done only in an instance context, but is happen whenever a chain of private extensions includes one inherited discriminant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223565 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 22 ++++++++++++++++++++++ gcc/ada/exp_aggr.adb | 13 ++++++------- gcc/ada/sem_ch10.adb | 6 ++++++ gcc/ada/sem_ch8.adb | 10 ++++++++-- gcc/ada/sinfo.ads | 10 ++++++++++ 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 863e3d9d26e..7482e0ccc5d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2015-05-22 Ed Schonberg + + * sem_ch10.adb (Analyze_With_Clause): In ASIS_Mode, a + limited_with clause on a predefined unit is not transformed into + a regular with_clause, to preserve the original tree structure. + * sinfo.ads (N_With_Clause): Add comment on handling of + Limited_With. + * sem_ch10.adb: Minor reformatting. + +2015-05-22 Ed Schonberg + + * sem_ch8.adb (Freeze_Profile): A limited view of a type in + the profile of a subprogram renaming does not require freezing, + because it is declared in a different unit. + +2015-05-22 Ed Schonberg + + * exp_aggr.adb (Get_Constraint_Association): If type (of ancestor + composite type) is private, go to full view. This was previously + done only in an instance context, but is happen whenever a chain + of private extensions includes one inherited discriminant. + 2015-05-22 Robert Dewar * einfo.ads: Minor comment updates. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 70f49688b86..8651074d492 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -2065,19 +2065,18 @@ package body Exp_Aggr is begin Typ := T; - -- Handle private types in instances + -- If type is private, get constraint from full view. This was + -- previously done in an instance context, but is needed whenever + -- the ancestor part has a discriminant, possibly inherited through + -- multiple derivations. - if In_Instance - and then Is_Private_Type (Typ) - and then Present (Full_View (Typ)) - then + if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then Typ := Full_View (Typ); end if; Indic := Subtype_Indication (Type_Definition (Parent (Typ))); - -- ??? Also need to cover case of a type mark denoting a subtype - -- with constraint. + -- Verify that the subtype indication carries a constraint if Nkind (Indic) = N_Subtype_Indication and then Present (Constraint (Indic)) diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 5824154b49c..55456e6996f 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -2560,6 +2560,12 @@ package body Sem_Ch10 is if Sloc (U) /= No_Location then if Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (U))) + + -- In ASIS mode the rtsfind mechanism plays no role, and + -- we need to maintain the original tree structure, so + -- this transformation is not performed in this case. + + and then not ASIS_Mode then Set_Limited_Present (N, False); Analyze_With_Clause (N); diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 6772328ff96..689aa8ddd7b 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -2493,8 +2493,7 @@ package body Sem_Ch8 is end loop; if Ekind (Formal_Spec) = E_Function - and then Ekind (Etype (Formal_Spec)) = E_Incomplete_Type - and then not Is_Tagged_Type (Etype (F)) + and then not Is_Tagged_Type (Etype (Formal_Spec)) then Has_Untagged_Inc := True; end if; @@ -2514,6 +2513,13 @@ package body Sem_Ch8 is or else Is_Generic_Type (Root_Type (Etype (F))) then null; + + -- A limited view of a type declared elsewhere needs no + -- freezing actions. + + elsif From_Limited_With (Etype (F)) then + null; + else Error_Msg_NE ("type& must be frozen before this point", diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 5ced3564aa8..4af7b5424ee 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -521,6 +521,9 @@ package Sinfo is -- simply ignore these nodes, since they are not relevant to the task -- of back annotating representation information. + -- Some other ASIS-specific issues are covered in specific comments in + -- sections for particular nodes or flags. + ---------------- -- Ghost Mode -- ---------------- @@ -6384,6 +6387,13 @@ package Sinfo is -- Similarly, Private_Present is used to support the implementation of -- Ada 2005 (AI-50262). + -- Note: if the WITH clause refers to a standard library unit, then a + -- limited with clause is changed into a normal with clause, because we + -- are not prepared to deal with limited with in the context of Rtsfind. + -- So in this case, the Limited_Present flag will be False in the final + -- tree. However, we do NOT do this transformation in ASIS mode, so for + -- ASIS the flag will remain set in this situation. + ---------------------- -- With_Type clause -- ---------------------- -- 2.11.4.GIT