From: Ed Schonberg Date: Thu, 4 Aug 2011 09:11:43 +0000 (+0000) Subject: sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a completion and... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=deb4f5ba328e83f81427014132325c7a1d59b7bb;p=gcc.git sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a completion and aspects are present... 2011-08-04 Ed Schonberg * sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a completion and aspects are present, apply them to the entity for the type which is currently the partial view, but which is the one that will be frozen. * sem_ch13.adb (Analyze_Aspect_Specifications): if the predicate applies to a partial view, indicate that the full view has predicates and delayed aspects. (Replace_Type_Reference): Handle properly predicates that apply to the full view of a private completion. From-SVN: r177340 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 019f5a25bc2..6ce04203d0c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2011-08-04 Ed Schonberg + + * sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a + completion and aspects are present, apply them to the entity for the + type which is currently the partial view, but which is the one that + will be frozen. + * sem_ch13.adb (Analyze_Aspect_Specifications): if the predicate + applies to a partial view, indicate that the full view has predicates + and delayed aspects. + (Replace_Type_Reference): Handle properly predicates that apply to the + full view of a private completion. + 2011-08-04 Eric Botcazou * layout.adb (Layout_Type): For composite types, do not set Esize. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index c3816cc577a..0423d613002 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -695,8 +695,8 @@ package body Sem_Ch13 is -- Insert pragmas (except Pre/Post/Invariant/Predicate) after this node -- The general processing involves building an attribute definition - -- clause or a pragma node that corresponds to the access type. Then - -- one of two things happens: + -- clause or a pragma node that corresponds to the aspect. Then one + -- of two things happens: -- If we are required to delay the evaluation of this aspect to the -- freeze point, we attach the corresponding pragma/attribute definition @@ -1238,6 +1238,14 @@ package body Sem_Ch13 is -- have a place to build the predicate function). Set_Has_Predicates (E); + + if Is_Private_Type (E) + and then Present (Full_View (E)) + then + Set_Has_Predicates (Full_View (E)); + Set_Has_Delayed_Aspects (Full_View (E)); + end if; + Ensure_Freeze_Node (E); Set_Is_Delayed_Aspect (Aspect); Delay_Required := True; @@ -4221,8 +4229,13 @@ package body Sem_Ch13 is Arg2 := Get_Pragma_Arg (Arg2); -- See if this predicate pragma is for the current type + -- or for its full view. A predicate on a private completion + -- is placed on the partial view beause this is the visible + -- entity that is frozen.. - if Entity (Arg1) = Typ then + if Entity (Arg1) = Typ + or else Full_View (Entity (Arg1)) = Typ + then -- We have a match, this entry is for our subtype diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index d31aea0ac98..0586b71c384 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2500,8 +2500,16 @@ package body Sem_Ch3 is Set_Optimize_Alignment_Flags (Def_Id); Check_Eliminated (Def_Id); + -- If the declaration is a completion and aspects are present, apply + -- them to the entity for the type which is currently the partial + -- view, but which is the one that will be frozen. + if Has_Aspects (N) then - Analyze_Aspect_Specifications (N, Def_Id); + if Prev /= Def_Id then + Analyze_Aspect_Specifications (N, Prev); + else + Analyze_Aspect_Specifications (N, Def_Id); + end if; end if; end Analyze_Full_Type_Declaration;