From cbae498bb28dc9997ed129456abaa95fb0ed6758 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 24 Nov 2009 20:02:40 +0000 Subject: [PATCH] exp_util.adb (Make_CW_Equivalent_Type): Do not mark the type as frozen for targets that do not require front-end layout. * exp_util.adb (Make_CW_Equivalent_Type): Do not mark the type as frozen for targets that do not require front-end layout. (New_Class_Wide_Subtype): Always reset the freezing status to False. * exp_ch8.adb: Do not 'with' Targparm. (Expand_N_Object_Renaming_Declaration): Always freeze a class-wide subtype that has been built from the expression. * exp_intr.adb (Expand_Unc_Deallocation): If the designated type is class wide, freeze the implicit type that has been built from the expression at the dereference point. * freeze.adb (Freeze_Entity): Adjust comment. * gcc-interface/decl.c (Gigi_Equivalent_Type) : Remove useless test. * gcc-interface/trans.c (process_freeze_entity): Do not special-case class-wide subtypes. * s-osinte-aix.adb (clock_gettime): Fix comment. * s-osinte-darwin.adb (clock_gettime): Likewise. From-SVN: r154514 --- gcc/ada/ChangeLog | 20 ++++++++++++++++++++ gcc/ada/exp_ch8.adb | 15 ++++----------- gcc/ada/exp_intr.adb | 9 +++++++-- gcc/ada/exp_util.adb | 26 +------------------------- gcc/ada/freeze.adb | 5 +---- gcc/ada/gcc-interface/decl.c | 4 +--- gcc/ada/gcc-interface/trans.c | 8 +++----- gcc/ada/s-osinte-aix.adb | 3 +-- gcc/ada/s-osinte-darwin.adb | 3 +-- 9 files changed, 39 insertions(+), 54 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a0ed110a50fb..b8702d5fabef 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,23 @@ +2009-11-24 Eric Botcazou + + * exp_util.adb (Make_CW_Equivalent_Type): Do not mark the type as + frozen for targets that do not require front-end layout. + (New_Class_Wide_Subtype): Always reset the freezing status to False. + * exp_ch8.adb: Do not 'with' Targparm. + (Expand_N_Object_Renaming_Declaration): Always freeze a class-wide + subtype that has been built from the expression. + * exp_intr.adb (Expand_Unc_Deallocation): If the designated type is + class wide, freeze the implicit type that has been built from the + expression at the dereference point. + * freeze.adb (Freeze_Entity): Adjust comment. + * gcc-interface/decl.c (Gigi_Equivalent_Type) : + Remove useless test. + * gcc-interface/trans.c (process_freeze_entity): Do not special-case + class-wide subtypes. + + * s-osinte-aix.adb (clock_gettime): Fix comment. + * s-osinte-darwin.adb (clock_gettime): Likewise. + 2009-11-23 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Pass the list diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb index 68fa50eb6e58..fc2837159419 100644 --- a/gcc/ada/exp_ch8.adb +++ b/gcc/ada/exp_ch8.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,7 +35,6 @@ with Sem; use Sem; with Sem_Ch8; use Sem_Ch8; with Sinfo; use Sinfo; with Stand; use Stand; -with Targparm; use Targparm; package body Exp_Ch8 is @@ -254,15 +253,9 @@ package body Exp_Ch8 is Set_Etype (Defining_Identifier (N), Entity (Subtype_Mark (N))); -- Freeze the class-wide subtype here to ensure that the subtype - -- and equivalent type are frozen before the renaming. This is - -- required for targets where Frontend_Layout_On_Target is true. - -- For targets where Gigi is used, class-wide subtype should not - -- be frozen (in that case the subtype is marked as already frozen - -- when it's created). - - if Frontend_Layout_On_Target then - Freeze_Before (N, Entity (Subtype_Mark (N))); - end if; + -- and equivalent type are frozen before the renaming. + + Freeze_Before (N, Entity (Subtype_Mark (N))); end if; -- Ada 2005 (AI-318-02): If the renamed object is a call to a build-in- diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb index da1314c3aa78..8f41a63c470a 100644 --- a/gcc/ada/exp_intr.adb +++ b/gcc/ada/exp_intr.adb @@ -1018,14 +1018,19 @@ package body Exp_Intr is else D_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - Insert_Action (N, + Insert_Action (Deref, Make_Subtype_Declaration (Loc, Defining_Identifier => D_Type, Subtype_Indication => D_Subtyp)); - Freeze_Itype (D_Type, N); end if; + -- Force freezing at the point of the dereference. For the + -- class wide case, this avoids having the subtype frozen + -- before the equivalent type. + + Freeze_Itype (D_Type, Deref); + Set_Actual_Designated_Subtype (Free_Node, D_Type); end; diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index fcf3878f61df..535ec4ca16ee 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -3775,19 +3775,6 @@ package body Exp_Util is -- end Equiv_T; Equiv_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); - - -- When the target requires front-end layout, it's necessary to allow - -- the equivalent type to be frozen so that layout can occur (when the - -- associated class-wide subtype is frozen, the equivalent type will - -- be frozen, see freeze.adb). For other targets, Gigi wants to have - -- the equivalent type marked as frozen and deals with this type itself. - -- In the Gigi case this will also avoid the generation of an init - -- procedure for the type. - - if not Frontend_Layout_On_Target then - Set_Is_Frozen (Equiv_Type); - end if; - Set_Ekind (Equiv_Type, E_Record_Type); Set_Parent_Subtype (Equiv_Type, Constr_Root); @@ -4090,18 +4077,7 @@ package body Exp_Util is Set_Ekind (Res, E_Class_Wide_Subtype); Set_Next_Entity (Res, Empty); Set_Etype (Res, Base_Type (CW_Typ)); - - -- For targets where front-end layout is required, reset the Is_Frozen - -- status of the subtype to False (it can be implicitly set to true - -- from the copy of the class-wide type). For other targets, Gigi - -- doesn't want the class-wide subtype to go through the freezing - -- process (though it's unclear why that causes problems and it would - -- be nice to allow freezing to occur normally for all targets ???). - - if Frontend_Layout_On_Target then - Set_Is_Frozen (Res, False); - end if; - + Set_Is_Frozen (Res, False); Set_Freeze_Node (Res, Empty); return (Res); end New_Class_Wide_Subtype; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 56389bb05355..85206f7ae8b7 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -3459,10 +3459,7 @@ package body Freeze is end if; -- The equivalent type associated with a class-wide subtype needs - -- to be frozen to ensure that its layout is done. Class-wide - -- subtypes are currently only frozen on targets requiring - -- front-end layout (see New_Class_Wide_Subtype and - -- Make_CW_Equivalent_Type in exp_util.adb). + -- to be frozen to ensure that its layout is done. if Ekind (E) = E_Class_Wide_Subtype and then Present (Equivalent_Type (E)) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ceb1f349ce8d..925610ce32e4 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4965,9 +4965,7 @@ Gigi_Equivalent_Type (Entity_Id gnat_entity) break; case E_Class_Wide_Type: - gnat_equiv = ((Present (Equivalent_Type (gnat_entity))) - ? Equivalent_Type (gnat_entity) - : Root_Type (gnat_entity)); + gnat_equiv = Root_Type (gnat_entity); break; case E_Task_Type: diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 41be8bb77af4..51c846f8d377 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6087,11 +6087,9 @@ process_freeze_entity (Node_Id gnat_node) if (Present (Address_Clause (gnat_entity))) gnu_old = 0; - /* Don't do anything for class-wide types they are always - transformed into their root type. */ - if (Ekind (gnat_entity) == E_Class_Wide_Type - || (Ekind (gnat_entity) == E_Class_Wide_Subtype - && Present (Equivalent_Type (gnat_entity)))) + /* Don't do anything for class-wide types as they are always transformed + into their root type. */ + if (Ekind (gnat_entity) == E_Class_Wide_Type) return; /* Don't do anything for subprograms that may have been elaborated before diff --git a/gcc/ada/s-osinte-aix.adb b/gcc/ada/s-osinte-aix.adb index 15b4d63db43a..bfe03a637b2c 100644 --- a/gcc/ada/s-osinte-aix.adb +++ b/gcc/ada/s-osinte-aix.adb @@ -110,8 +110,7 @@ package body System.OS_Interface is is pragma Unreferenced (clock_id); - -- Darwin threads don't have clock_gettime, so use - -- gettimeofday() instead. + -- Older AIX don't have clock_gettime, so use gettimeofday use Interfaces; diff --git a/gcc/ada/s-osinte-darwin.adb b/gcc/ada/s-osinte-darwin.adb index 1f47ddeb409e..3bf0bb96d659 100644 --- a/gcc/ada/s-osinte-darwin.adb +++ b/gcc/ada/s-osinte-darwin.adb @@ -93,8 +93,7 @@ package body System.OS_Interface is is pragma Unreferenced (clock_id); - -- AIX threads don't have clock_gettime, so use - -- gettimeofday() instead. + -- Darwin Threads don't have clock_gettime, so use gettimeofday use Interfaces; -- 2.43.5