diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-06-06 09:18:41 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-06-06 09:18:41 +0000 |
commit | 4d9446f9c071edf7fad4a58267009fdd190de9d2 (patch) | |
tree | 2d5817f043242485f2d94a0fa3ffd9ef1f30087f /gcc/ada/freeze.adb | |
parent | 31ce61574321e0da9ca6567b8b85d4b3a16ddc0a (diff) | |
download | gcc-4d9446f9c071edf7fad4a58267009fdd190de9d2.zip gcc-4d9446f9c071edf7fad4a58267009fdd190de9d2.tar.gz gcc-4d9446f9c071edf7fad4a58267009fdd190de9d2.tar.bz2 |
einfo.ads (Returns_Limited_View): Remove.
* einfo.ads (Returns_Limited_View): Remove.
(Set_Returns_Limited_View ): Likewise.
* einfo.adb (Returns_Limited_View): Likewise.
(Set_Returns_Limited_View ): Likewise.
* freeze.adb (Late_Freeze_Subprogram): Remove.
(Freeze_Entity): Do not defer the freezing of functions returning an
incomplete type coming from a limited context.
From-SVN: r237121
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index ec8ea2c..66396c5 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1934,9 +1934,6 @@ package body Freeze is Has_Default_Initialization : Boolean := False; -- This flag gets set to true for a variable with default initialization - Late_Freezing : Boolean := False; - -- Used to detect attempt to freeze function declared in another unit - Result : List_Id := No_List; -- List of freezing actions, left at No_List if none @@ -1973,9 +1970,8 @@ package body Freeze is function Freeze_Profile (E : Entity_Id) return Boolean; -- Freeze formals and return type of subprogram. If some type in the - -- profile is a limited view, freezing of the entity will take place - -- elsewhere, and the function returns False. This routine will be - -- modified if and when we can implement AI05-019 efficiently ??? + -- profile is incomplete and we are in an instance, freezing of the + -- entity will take place elsewhere, and the function returns False. procedure Freeze_Record_Type (Rec : Entity_Id); -- Freeze record type, including freezing component types, and freezing @@ -1985,16 +1981,6 @@ package body Freeze is -- Determine whether an arbitrary entity is subject to Boolean aspect -- Import and its value is specified as True. - procedure Late_Freeze_Subprogram (E : Entity_Id); - -- Following AI05-151, a function can return a limited view of a type - -- declared elsewhere. In that case the function cannot be frozen at - -- the end of its enclosing package. If its first use is in a different - -- unit, it cannot be frozen there, but if the call is legal the full - -- view of the return type is available and the subprogram can now be - -- frozen. However the freeze node cannot be inserted at the point of - -- call, but rather must go in the package holding the function, so that - -- the backend can process it in the proper context. - function New_Freeze_Node return Node_Id; -- Create a new freeze node for entity E @@ -3300,15 +3286,6 @@ package body Freeze is if Ekind (E) = E_Function then - -- Check whether function is declared elsewhere. Previous code - -- used Get_Source_Unit on both arguments, but the values are - -- equal in the case of a parent and a child unit. - -- Confusion with subunits in code ???? - - Late_Freezing := - not In_Same_Extended_Unit (E, N) - and then Returns_Limited_View (E); - -- Freeze return type R_Type := Etype (E); @@ -3326,24 +3303,6 @@ package body Freeze is then R_Type := Full_View (R_Type); Set_Etype (E, R_Type); - - -- If the return type is a limited view and the non-limited - -- view is still incomplete, the function has to be frozen at a - -- later time. If the function is abstract there is no place at - -- which the full view will become available, and no code to be - -- generated for it, so mark type as frozen. - - elsif Ekind (R_Type) = E_Incomplete_Type - and then From_Limited_With (R_Type) - and then Ekind (Non_Limited_View (R_Type)) = E_Incomplete_Type - then - if Is_Abstract_Subprogram (E) then - null; - else - Set_Is_Frozen (E, False); - Set_Returns_Limited_View (E); - return False; - end if; end if; Freeze_And_Append (R_Type, N, Result); @@ -4613,25 +4572,6 @@ package body Freeze is return False; end Has_Boolean_Aspect_Import; - ---------------------------- - -- Late_Freeze_Subprogram -- - ---------------------------- - - procedure Late_Freeze_Subprogram (E : Entity_Id) is - Spec : constant Node_Id := - Specification (Unit_Declaration_Node (Scope (E))); - Decls : List_Id; - - begin - if Present (Private_Declarations (Spec)) then - Decls := Private_Declarations (Spec); - else - Decls := Visible_Declarations (Spec); - end if; - - Append_List (Result, Decls); - end Late_Freeze_Subprogram; - --------------------- -- New_Freeze_Node -- --------------------- @@ -5111,12 +5051,6 @@ package body Freeze is Freeze_Subprogram (E); end if; - if Late_Freezing then - Late_Freeze_Subprogram (E); - Ghost_Mode := Save_Ghost_Mode; - return No_List; - end if; - -- If warning on suspicious contracts then check for the case of -- a postcondition other than False for a No_Return subprogram. |