Commit cbae498b by Eric Botcazou Committed by Eric Botcazou

exp_util.adb (Make_CW_Equivalent_Type): Do not mark the type as frozen for…

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) <E_Class_Wide_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
parent 828514e4
2009-11-24 Eric Botcazou <ebotcazou@adacore.com>
* 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) <E_Class_Wide_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 <ebotcazou@adacore.com> 2009-11-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Pass the list * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Pass the list
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -35,7 +35,6 @@ with Sem; use Sem; ...@@ -35,7 +35,6 @@ with Sem; use Sem;
with Sem_Ch8; use Sem_Ch8; with Sem_Ch8; use Sem_Ch8;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
with Stand; use Stand; with Stand; use Stand;
with Targparm; use Targparm;
package body Exp_Ch8 is package body Exp_Ch8 is
...@@ -254,15 +253,9 @@ package body Exp_Ch8 is ...@@ -254,15 +253,9 @@ package body Exp_Ch8 is
Set_Etype (Defining_Identifier (N), Entity (Subtype_Mark (N))); Set_Etype (Defining_Identifier (N), Entity (Subtype_Mark (N)));
-- Freeze the class-wide subtype here to ensure that the subtype -- Freeze the class-wide subtype here to ensure that the subtype
-- and equivalent type are frozen before the renaming. This is -- and equivalent type are frozen before the renaming.
-- required for targets where Frontend_Layout_On_Target is true.
-- For targets where Gigi is used, class-wide subtype should not Freeze_Before (N, Entity (Subtype_Mark (N)));
-- 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;
end if; end if;
-- Ada 2005 (AI-318-02): If the renamed object is a call to a build-in- -- Ada 2005 (AI-318-02): If the renamed object is a call to a build-in-
......
...@@ -1018,14 +1018,19 @@ package body Exp_Intr is ...@@ -1018,14 +1018,19 @@ package body Exp_Intr is
else else
D_Type := Make_Defining_Identifier (Loc, D_Type := Make_Defining_Identifier (Loc,
New_Internal_Name ('A')); New_Internal_Name ('A'));
Insert_Action (N, Insert_Action (Deref,
Make_Subtype_Declaration (Loc, Make_Subtype_Declaration (Loc,
Defining_Identifier => D_Type, Defining_Identifier => D_Type,
Subtype_Indication => D_Subtyp)); Subtype_Indication => D_Subtyp));
Freeze_Itype (D_Type, N);
end if; 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); Set_Actual_Designated_Subtype (Free_Node, D_Type);
end; end;
......
...@@ -3775,19 +3775,6 @@ package body Exp_Util is ...@@ -3775,19 +3775,6 @@ package body Exp_Util is
-- end Equiv_T; -- end Equiv_T;
Equiv_Type := Make_Defining_Identifier (Loc, New_Internal_Name ('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_Ekind (Equiv_Type, E_Record_Type);
Set_Parent_Subtype (Equiv_Type, Constr_Root); Set_Parent_Subtype (Equiv_Type, Constr_Root);
...@@ -4090,18 +4077,7 @@ package body Exp_Util is ...@@ -4090,18 +4077,7 @@ package body Exp_Util is
Set_Ekind (Res, E_Class_Wide_Subtype); Set_Ekind (Res, E_Class_Wide_Subtype);
Set_Next_Entity (Res, Empty); Set_Next_Entity (Res, Empty);
Set_Etype (Res, Base_Type (CW_Typ)); Set_Etype (Res, Base_Type (CW_Typ));
Set_Is_Frozen (Res, False);
-- 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_Freeze_Node (Res, Empty); Set_Freeze_Node (Res, Empty);
return (Res); return (Res);
end New_Class_Wide_Subtype; end New_Class_Wide_Subtype;
......
...@@ -3459,10 +3459,7 @@ package body Freeze is ...@@ -3459,10 +3459,7 @@ package body Freeze is
end if; end if;
-- The equivalent type associated with a class-wide subtype needs -- The equivalent type associated with a class-wide subtype needs
-- to be frozen to ensure that its layout is done. Class-wide -- to be frozen to ensure that its layout is done.
-- 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).
if Ekind (E) = E_Class_Wide_Subtype if Ekind (E) = E_Class_Wide_Subtype
and then Present (Equivalent_Type (E)) and then Present (Equivalent_Type (E))
......
...@@ -4965,9 +4965,7 @@ Gigi_Equivalent_Type (Entity_Id gnat_entity) ...@@ -4965,9 +4965,7 @@ Gigi_Equivalent_Type (Entity_Id gnat_entity)
break; break;
case E_Class_Wide_Type: case E_Class_Wide_Type:
gnat_equiv = ((Present (Equivalent_Type (gnat_entity))) gnat_equiv = Root_Type (gnat_entity);
? Equivalent_Type (gnat_entity)
: Root_Type (gnat_entity));
break; break;
case E_Task_Type: case E_Task_Type:
......
...@@ -6087,11 +6087,9 @@ process_freeze_entity (Node_Id gnat_node) ...@@ -6087,11 +6087,9 @@ process_freeze_entity (Node_Id gnat_node)
if (Present (Address_Clause (gnat_entity))) if (Present (Address_Clause (gnat_entity)))
gnu_old = 0; gnu_old = 0;
/* Don't do anything for class-wide types they are always /* Don't do anything for class-wide types as they are always transformed
transformed into their root type. */ into their root type. */
if (Ekind (gnat_entity) == E_Class_Wide_Type if (Ekind (gnat_entity) == E_Class_Wide_Type)
|| (Ekind (gnat_entity) == E_Class_Wide_Subtype
&& Present (Equivalent_Type (gnat_entity))))
return; return;
/* Don't do anything for subprograms that may have been elaborated before /* Don't do anything for subprograms that may have been elaborated before
......
...@@ -110,8 +110,7 @@ package body System.OS_Interface is ...@@ -110,8 +110,7 @@ package body System.OS_Interface is
is is
pragma Unreferenced (clock_id); pragma Unreferenced (clock_id);
-- Darwin threads don't have clock_gettime, so use -- Older AIX don't have clock_gettime, so use gettimeofday
-- gettimeofday() instead.
use Interfaces; use Interfaces;
......
...@@ -93,8 +93,7 @@ package body System.OS_Interface is ...@@ -93,8 +93,7 @@ package body System.OS_Interface is
is is
pragma Unreferenced (clock_id); pragma Unreferenced (clock_id);
-- AIX threads don't have clock_gettime, so use -- Darwin Threads don't have clock_gettime, so use gettimeofday
-- gettimeofday() instead.
use Interfaces; use Interfaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment