From b8a93198c2286edd6954930696ff8c1a6607785b Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 6 Sep 2011 10:03:04 +0200 Subject: [PATCH] [multiple changes] 2011-09-06 Steve Baird * einfo.ads (Extra_Accessibility): Update associated comment to use the term "present" correctly ("present" just means that it is not an error to query the value of the attribute - it does not imply that the value must be non-null). (Extra_Constrained): Ditto. (Is_Visible_Formal): Ditto. (Extra_Accessibility_Of_Result) Ditto; also add Inline pragma. (Set_Extra_Accessibility_Of_Result): Add Inline pragma. * exp_ch4.adb (Expand_Allocator_Expression): Improve a comment. * exp_ch6.adb (Expand_Call): The callee may require an Extra_Accessibility_Of_Result actual parameter even if Ada_Version < Ada_2012. This can occur if the callee is exported from a Gnat runtimes unit. Also improve a comment. 2011-09-06 Hristian Kirtchev * exp_ch7.adb: Add with and use clauses for Get_Targ. (Alignment_Of): Rename formal parameter Some_Typ to Typ, update related comment. Use the allocator alignment on strict alignment targets such as SPARC. (Double_Alignment_Of): Rename formal parameter Some_Typ to Typ, update related comment. 2011-09-06 Gary Dismukes * sem_ch9.adb (Check_Interfaces): Test Is_Limited_Type rather than Is_Limited_Record when checking that the partial view of a synchronized full view must be limited. 2011-09-06 Emmanuel Briot * g-comlin.adb (Free): Fix memory leak. From-SVN: r178569 --- gcc/ada/ChangeLog | 35 +++++++++++++++++++++++++++++++++++ gcc/ada/einfo.ads | 25 +++++++++++++------------ gcc/ada/exp_ch4.adb | 2 -- gcc/ada/exp_ch6.adb | 5 +---- gcc/ada/exp_ch7.adb | 31 ++++++++++++++++++++----------- gcc/ada/g-comlin.adb | 3 +++ gcc/ada/sem_ch9.adb | 2 +- 7 files changed, 73 insertions(+), 30 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8d875b6de8d..b887ead748a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,38 @@ +2011-09-06 Steve Baird + + * einfo.ads (Extra_Accessibility): Update associated comment to use + the term "present" correctly ("present" just means that it is not + an error to query the value of the attribute - it does not imply + that the value must be non-null). + (Extra_Constrained): Ditto. + (Is_Visible_Formal): Ditto. + (Extra_Accessibility_Of_Result) Ditto; also add Inline pragma. + (Set_Extra_Accessibility_Of_Result): Add Inline pragma. + * exp_ch4.adb (Expand_Allocator_Expression): Improve a comment. + * exp_ch6.adb (Expand_Call): The callee may require an + Extra_Accessibility_Of_Result actual parameter even if Ada_Version + < Ada_2012. This can occur if the callee is exported from a Gnat + runtimes unit. Also improve a comment. + +2011-09-06 Hristian Kirtchev + + * exp_ch7.adb: Add with and use clauses for Get_Targ. + (Alignment_Of): Rename formal parameter Some_Typ + to Typ, update related comment. Use the allocator alignment on + strict alignment targets such as SPARC. + (Double_Alignment_Of): Rename formal parameter Some_Typ to Typ, update + related comment. + +2011-09-06 Gary Dismukes + + * sem_ch9.adb (Check_Interfaces): Test + Is_Limited_Type rather than Is_Limited_Record when checking that + the partial view of a synchronized full view must be limited. + +2011-09-06 Emmanuel Briot + + * g-comlin.adb (Free): Fix memory leak. + 2011-09-06 Robert Dewar * sem_util.adb, exp_ch6.adb: Minor reformatting and code reorganization. diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 7e8d8196098..871a2cf3951 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1120,9 +1120,9 @@ package Einfo is -- or entry. Returns Empty if there are no extra formals. -- Extra_Accessibility (Node13) --- Present in formal parameters in the non-generic case if expansion is --- active. Normally Empty, but if a parameter is one for which a dynamic --- accessibility check is required, then an extra formal of type +-- Present in formal parameters in the non-generic case. Normally Empty, +-- but if expansion is active, and a parameter is one for which a +-- dynamic accessibility check is required, then an extra formal of type -- Natural is created (see description of field Extra_Formal), and the -- Extra_Accessibility field of the formal parameter points to the entity -- for this extra formal. Also present in variables when compiling @@ -1133,16 +1133,16 @@ package Einfo is -- Extra_Accessibility_Of_Result (Node19) -- Present in (non-generic) Function, Operator, and Subprogram_Type --- entities if expansion is active. Normally Empty, but if a function is --- one for which "the accessibility level of the result ... determined +-- entities. Normally Empty, but if expansion is active, and a function +-- is one for which "the accessibility level of the result ... determined -- by the point of call" (AI05-0234) is needed, then an extra formal of -- subtype Natural is created (see description of field Extra_Formal), -- and the Extra_Accessibility_Of_Result field of the function points to -- the entity for this extra formal. -- Extra_Constrained (Node23) --- Present in formal parameters in the non-generic case if expansion is --- active. Normally Empty, but if a parameter is one for which a dynamic +-- Present in formal parameters in the non-generic case. Normally Empty, +-- but if expansion is active and a parameter is one for which a dynamic -- indication of its constrained status is required, then an extra formal -- of type Boolean is created (see description of field Extra_Formal), -- and the Extra_Constrained field of the formal parameter points to the @@ -2853,11 +2853,10 @@ package Einfo is -- visible by selected notation, or not. -- Is_Visible_Formal (Flag206) --- Present in all entities. Set for instances of the formals of a formal --- package. Indicates that the entity must be made visible in the body --- of the instance, to reproduce the visibility of the generic. This --- simplifies visibility settings in instance bodies. --- ??? confusion in above comments between being present and being set +-- Present in all entities. Set True for instances of the formals of a +-- formal package. Indicates that the entity must be made visible in the +-- body of the instance, to reproduce the visibility of the generic. +-- This simplifies visibility settings in instance bodies. -- Is_VMS_Exception (Flag133) -- Present in all entities. Set only for exception entities where the @@ -7373,6 +7372,7 @@ package Einfo is pragma Inline (Esize); pragma Inline (Exception_Code); pragma Inline (Extra_Accessibility); + pragma Inline (Extra_Accessibility_Of_Result); pragma Inline (Extra_Constrained); pragma Inline (Extra_Formal); pragma Inline (Extra_Formals); @@ -7817,6 +7817,7 @@ package Einfo is pragma Inline (Set_Esize); pragma Inline (Set_Exception_Code); pragma Inline (Set_Extra_Accessibility); + pragma Inline (Set_Extra_Accessibility_Of_Result); pragma Inline (Set_Extra_Constrained); pragma Inline (Set_Extra_Formal); pragma Inline (Set_Extra_Formals); diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index d018d4c426c..2b9ab014bfc 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -765,8 +765,6 @@ package body Exp_Ch4 is -- Start of processing for Expand_Allocator_Expression begin - -- Messy??? - -- In the case of an Ada2012 allocator whose initial value comes from a -- function call, pass "the accessibility level determined by the point -- of call" (AI05-0234) to the function. Conceptually, this belongs in diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 7c9ce179ace..2638137b28f 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -2753,8 +2753,7 @@ package body Exp_Ch6 is -- "accessibility level determined by the point of call" (AI05-0234) -- passed in to it, then pass it in. - if Ada_Version >= Ada_2012 - and then Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type) + if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type) and then Present (Extra_Accessibility_Of_Result (Subp)) then declare @@ -2781,8 +2780,6 @@ package body Exp_Ch6 is case Nkind (Ancestor) is when N_Allocator => - -- Messy code, could use a cleanup??? - -- At this point, we'd like to assign -- Level := Dynamic_Accessibility_Level (Ancestor); diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 3a4b07dc63f..eebb79d7c66 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -41,6 +41,7 @@ with Exp_Disp; use Exp_Disp; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; +with Get_Targ; use Get_Targ; with Lib; use Lib; with Nlists; use Nlists; with Nmake; use Nmake; @@ -7033,38 +7034,46 @@ package body Exp_Ch7 is Desg_Typ : Entity_Id; Obj_Expr : Node_Id; - function Alignment_Of (Some_Typ : Entity_Id) return Node_Id; + function Alignment_Of (Typ : Entity_Id) return Node_Id; -- Subsidiary routine, generate the following attribute reference: -- - -- Some_Typ'Alignment + -- Typ'Alignment - function Double_Alignment_Of (Some_Typ : Entity_Id) return Node_Id; + function Double_Alignment_Of (Typ : Entity_Id) return Node_Id; -- Subsidiary routine, generate the following expression: -- - -- 2 * Some_Typ'Alignment + -- 2 * Typ'Alignment ------------------ -- Alignment_Of -- ------------------ - function Alignment_Of (Some_Typ : Entity_Id) return Node_Id is + function Alignment_Of (Typ : Entity_Id) return Node_Id is begin - return - Make_Attribute_Reference (Loc, - Prefix => New_Reference_To (Some_Typ, Loc), - Attribute_Name => Name_Alignment); + -- Strict alignment targets such as SPARC ignore the alignment of the + -- index type and use the system allocator alignment instead. + + if Target_Strict_Alignment then + return Make_Integer_Literal (Loc, Get_System_Allocator_Alignment); + + else + return + Make_Attribute_Reference (Loc, + Prefix => New_Reference_To (Typ, Loc), + Attribute_Name => Name_Alignment); + end if; end Alignment_Of; ------------------------- -- Double_Alignment_Of -- ------------------------- - function Double_Alignment_Of (Some_Typ : Entity_Id) return Node_Id is + function Double_Alignment_Of (Typ : Entity_Id) return Node_Id is begin return Make_Op_Multiply (Loc, Left_Opnd => Make_Integer_Literal (Loc, 2), - Right_Opnd => Alignment_Of (Some_Typ)); + Right_Opnd => Alignment_Of (Typ)); end Double_Alignment_Of; -- Start of processing for Make_Finalize_Address_Stmts diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index e83ad519f63..e18a2b1ead6 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -2982,6 +2982,7 @@ package body GNAT.Command_Line is Free (Config.Sections); Free (Config.Usage); Free (Config.Help); + Free (Config.Help_Msg); if Config.Aliases /= null then for A in Config.Aliases'Range loop @@ -3037,6 +3038,8 @@ package body GNAT.Command_Line is end if; Free (Config.Usage); + Free (Config.Help); + Free (Config.Help_Msg); Config.Usage := new String'(Usage); Config.Help := new String'(Help); Config.Help_Msg := new String'(Help_Msg); diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index 5fbb0ecb97e..b4a4c456dc5 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -2381,7 +2381,7 @@ package body Sem_Ch9 is -- declaration must be limited. if Present (Interface_List (N)) - and then not Is_Limited_Record (Priv_T) + and then not Is_Limited_Type (Priv_T) then Error_Msg_Sloc := Sloc (Priv_T); Error_Msg_N ("(Ada 2005) limited type declaration expected for " &