Commit a73734f5 by Arnaud Charlet

[multiple changes]

2009-07-29  Robert Dewar  <dewar@adacore.com>

	* exp_atag.ads, exp_atag.adb, s-tasini.adb, s-soflin.ads,
	exp_disp.adb, g-socket.adb: Minor reformatting

2009-07-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch7.adb (New_Private_Type): Create class-wide type after other
	attributes have been established, so that they are all inherited by the
	class-wide type.
	* sem_cat.adb (Validate_Remote_Access_Object_Type_Declaration): Handle
	properly named subtypes of class-wide types.

From-SVN: r150201
parent 53b10ce9
2009-07-29 Robert Dewar <dewar@adacore.com>
* exp_atag.ads, exp_atag.adb, s-tasini.adb, s-soflin.ads,
exp_disp.adb, g-socket.adb: Minor reformatting
2009-07-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch7.adb (New_Private_Type): Create class-wide type after other
attributes have been established, so that they are all inherited by the
class-wide type.
* sem_cat.adb (Validate_Remote_Access_Object_Type_Declaration): Handle
properly named subtypes of class-wide types.
2009-07-29 Ed Schonberg <schonberg@adacore.com> 2009-07-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Check_Overriding_Indicator): Handle properly overriding * sem_ch6.adb (Check_Overriding_Indicator): Handle properly overriding
......
...@@ -231,7 +231,7 @@ package body Exp_Atag is ...@@ -231,7 +231,7 @@ package body Exp_Atag is
(Loc : Source_Ptr; (Loc : Source_Ptr;
Position : Uint; Position : Uint;
Tag_Node : in out Node_Id; Tag_Node : in out Node_Id;
New_Node : out Node_Id) New_Node : out Node_Id)
is is
Ctrl_Tag : Node_Id; Ctrl_Tag : Node_Id;
...@@ -352,7 +352,7 @@ package body Exp_Atag is ...@@ -352,7 +352,7 @@ package body Exp_Atag is
Typ : Entity_Id; Typ : Entity_Id;
Position : Uint; Position : Uint;
Tag_Node : in out Node_Id; Tag_Node : in out Node_Id;
New_Node : out Node_Id) New_Node : out Node_Id)
is is
New_Prefix : Node_Id; New_Prefix : Node_Id;
......
...@@ -65,7 +65,7 @@ package Exp_Atag is ...@@ -65,7 +65,7 @@ package Exp_Atag is
(Loc : Source_Ptr; (Loc : Source_Ptr;
Position : Uint; Position : Uint;
Tag_Node : in out Node_Id; Tag_Node : in out Node_Id;
New_Node : out Node_Id); New_Node : out Node_Id);
-- Given a pointer to a dispatch table (T) and a position in the DT, build -- Given a pointer to a dispatch table (T) and a position in the DT, build
-- code that gets the address of the predefined virtual function stored in -- code that gets the address of the predefined virtual function stored in
-- it (used for dispatching calls). Tag_Node is relocated. -- it (used for dispatching calls). Tag_Node is relocated.
...@@ -77,7 +77,7 @@ package Exp_Atag is ...@@ -77,7 +77,7 @@ package Exp_Atag is
Typ : Entity_Id; Typ : Entity_Id;
Position : Uint; Position : Uint;
Tag_Node : in out Node_Id; Tag_Node : in out Node_Id;
New_Node : out Node_Id); New_Node : out Node_Id);
-- Build code that retrieves the address of the virtual function stored in -- Build code that retrieves the address of the virtual function stored in
-- a given position of the dispatch table (used for dispatching calls). -- a given position of the dispatch table (used for dispatching calls).
-- Tag_Node is relocated. -- Tag_Node is relocated.
......
...@@ -811,11 +811,11 @@ package body Exp_Disp is ...@@ -811,11 +811,11 @@ package body Exp_Disp is
else else
Controlling_Tag := Controlling_Tag :=
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => Duplicate_Subexpr_Move_Checks (Ctrl_Arg), Prefix => Duplicate_Subexpr_Move_Checks (Ctrl_Arg),
Selector_Name => New_Reference_To (DTC_Entity (Subp), Loc)); Selector_Name => New_Reference_To (DTC_Entity (Subp), Loc));
end if; end if;
-- Handle dispatching calls to predefined primitives. -- Handle dispatching calls to predefined primitives
if Is_Predefined_Dispatching_Operation (Subp) if Is_Predefined_Dispatching_Operation (Subp)
or else Is_Predefined_Dispatching_Alias (Subp) or else Is_Predefined_Dispatching_Alias (Subp)
...@@ -854,10 +854,10 @@ package body Exp_Disp is ...@@ -854,10 +854,10 @@ package body Exp_Disp is
-- Handle renaming of selected component -- Handle renaming of selected component
elsif Nkind (Controlling_Tag) = N_Identifier elsif Nkind (Controlling_Tag) = N_Identifier
and then Nkind (Parent (Entity (Controlling_Tag))) and then Nkind (Parent (Entity (Controlling_Tag))) =
= N_Object_Renaming_Declaration N_Object_Renaming_Declaration
and then Nkind (Name (Parent (Entity (Controlling_Tag)))) and then Nkind (Name (Parent (Entity (Controlling_Tag)))) =
= N_Selected_Component N_Selected_Component
then then
Set_SCIL_Controlling_Tag (SCIL_Node, Set_SCIL_Controlling_Tag (SCIL_Node,
Name (Parent (Entity (Controlling_Tag)))); Name (Parent (Entity (Controlling_Tag))));
...@@ -867,8 +867,8 @@ package body Exp_Disp is ...@@ -867,8 +867,8 @@ package body Exp_Disp is
elsif Nkind (Controlling_Tag) = N_Identifier elsif Nkind (Controlling_Tag) = N_Identifier
and then Nkind_In (Parent (Entity (Controlling_Tag)), and then Nkind_In (Parent (Entity (Controlling_Tag)),
N_Object_Declaration, N_Object_Declaration,
N_Parameter_Specification) N_Parameter_Specification)
then then
Set_SCIL_Controlling_Tag (SCIL_Node, Set_SCIL_Controlling_Tag (SCIL_Node,
Parent (Entity (Controlling_Tag))); Parent (Entity (Controlling_Tag)));
...@@ -879,8 +879,8 @@ package body Exp_Disp is ...@@ -879,8 +879,8 @@ package body Exp_Disp is
elsif Nkind (Controlling_Tag) = N_Explicit_Dereference elsif Nkind (Controlling_Tag) = N_Explicit_Dereference
and then Nkind (Prefix (Controlling_Tag)) = N_Identifier and then Nkind (Prefix (Controlling_Tag)) = N_Identifier
and then Nkind_In (Parent (Entity (Prefix (Controlling_Tag))), and then Nkind_In (Parent (Entity (Prefix (Controlling_Tag))),
N_Object_Declaration, N_Object_Declaration,
N_Parameter_Specification) N_Parameter_Specification)
then then
Set_SCIL_Controlling_Tag (SCIL_Node, Set_SCIL_Controlling_Tag (SCIL_Node,
Parent (Entity (Prefix (Controlling_Tag)))); Parent (Entity (Prefix (Controlling_Tag))));
...@@ -894,9 +894,9 @@ package body Exp_Disp is ...@@ -894,9 +894,9 @@ package body Exp_Disp is
then then
Set_SCIL_Controlling_Tag (SCIL_Node, Set_SCIL_Controlling_Tag (SCIL_Node,
Parent Parent
(Node (Node
(First_Elmt (First_Elmt
(Access_Disp_Table (Entity (Prefix (Controlling_Tag))))))); (Access_Disp_Table (Entity (Prefix (Controlling_Tag)))))));
-- Interfaces are not supported. For now we leave the SCIL node -- Interfaces are not supported. For now we leave the SCIL node
-- decorated with the Controlling_Tag. More work needed here??? -- decorated with the Controlling_Tag. More work needed here???
...@@ -913,7 +913,7 @@ package body Exp_Disp is ...@@ -913,7 +913,7 @@ package body Exp_Disp is
if Nkind (Call_Node) = N_Function_Call then if Nkind (Call_Node) = N_Function_Call then
New_Call := New_Call :=
Make_Function_Call (Loc, Make_Function_Call (Loc,
Name => New_Call_Name, Name => New_Call_Name,
Parameter_Associations => New_Params); Parameter_Associations => New_Params);
-- If this is a dispatching "=", we must first compare the tags so -- If this is a dispatching "=", we must first compare the tags so
...@@ -927,26 +927,26 @@ package body Exp_Disp is ...@@ -927,26 +927,26 @@ package body Exp_Disp is
Make_Op_Eq (Loc, Make_Op_Eq (Loc,
Left_Opnd => Left_Opnd =>
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => New_Value (Param), Prefix => New_Value (Param),
Selector_Name => Selector_Name =>
New_Reference_To (First_Tag_Component (Typ), New_Reference_To (First_Tag_Component (Typ),
Loc)), Loc)),
Right_Opnd => Right_Opnd =>
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => Prefix =>
Unchecked_Convert_To (Typ, Unchecked_Convert_To (Typ,
New_Value (Next_Actual (Param))), New_Value (Next_Actual (Param))),
Selector_Name => Selector_Name =>
New_Reference_To (First_Tag_Component (Typ), New_Reference_To
Loc))), (First_Tag_Component (Typ), Loc))),
Right_Opnd => New_Call); Right_Opnd => New_Call);
end if; end if;
else else
New_Call := New_Call :=
Make_Procedure_Call_Statement (Loc, Make_Procedure_Call_Statement (Loc,
Name => New_Call_Name, Name => New_Call_Name,
Parameter_Associations => New_Params); Parameter_Associations => New_Params);
end if; end if;
......
...@@ -1664,11 +1664,14 @@ package body GNAT.Sockets is ...@@ -1664,11 +1664,14 @@ package body GNAT.Sockets is
(Msg_Name => System.Null_Address, (Msg_Name => System.Null_Address,
Msg_Namelen => 0, Msg_Namelen => 0,
Msg_Iov => Vector'Address, Msg_Iov => Vector'Address,
Msg_Iovlen =>
SOSC.Msg_Iovlen_T'Min (Vector'Length, SOSC.IOV_MAX),
-- recvmsg(2) returns EMSGSIZE on Linux (and probably on other -- recvmsg(2) returns EMSGSIZE on Linux (and probably on other
-- platforms) when the supplied vector is longer than IOV_MAX, -- platforms) when the supplied vector is longer than IOV_MAX,
-- so use minimum of the two lengths. -- so use minimum of the two lengths.
Msg_Iovlen => SOSC.Msg_Iovlen_T'Min
(Vector'Length, SOSC.IOV_MAX),
Msg_Control => System.Null_Address, Msg_Control => System.Null_Address,
Msg_Controllen => 0, Msg_Controllen => 0,
Msg_Flags => 0); Msg_Flags => 0);
......
...@@ -242,7 +242,7 @@ package System.Soft_Links is ...@@ -242,7 +242,7 @@ package System.Soft_Links is
function Get_Exc_Stack_Addr_NT return Address; function Get_Exc_Stack_Addr_NT return Address;
Get_Exc_Stack_Addr : Get_Address_Call := Get_Exc_Stack_Addr_NT'Access; Get_Exc_Stack_Addr : Get_Address_Call := Get_Exc_Stack_Addr_NT'Access;
function Get_Current_Excep_NT return EOA; function Get_Current_Excep_NT return EOA;
Get_Current_Excep : Get_EOA_Call := Get_Current_Excep_NT'Access; Get_Current_Excep : Get_EOA_Call := Get_Current_Excep_NT'Access;
......
...@@ -191,8 +191,8 @@ package body System.Tasking.Initialization is ...@@ -191,8 +191,8 @@ package body System.Tasking.Initialization is
end if; end if;
-- pragma Assert -- pragma Assert
-- ((Self_ID.Pending_ATC_Level >= Self_ID.ATC_Nesting_Level or else -- (Self_ID.Pending_ATC_Level >= Self_ID.ATC_Nesting_Level or else
-- Self_ID.Deferral_Level > 0)); -- Self_ID.Deferral_Level > 0);
-- See comment in Defer_Abort on the situations in which it may be -- See comment in Defer_Abort on the situations in which it may be
-- useful to uncomment the above assertion. -- useful to uncomment the above assertion.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2008, 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- --
...@@ -1774,12 +1774,12 @@ package body Sem_Cat is ...@@ -1774,12 +1774,12 @@ package body Sem_Cat is
-- Check RCI or RT unit type declaration. It may not contain the -- Check RCI or RT unit type declaration. It may not contain the
-- declaration of an access-to-object type unless it is a general access -- declaration of an access-to-object type unless it is a general access
-- type that designates a class-wide limited private type. There are -- type that designates a class-wide limited private type or subtype.
-- also constraints on the primitive subprograms of the class-wide type -- There are also constraints on the primitive subprograms of the
-- (RM E.2.2(14), see Validate_RACW_Primitives). -- class-wide type (RM E.2.2(14), see Validate_RACW_Primitives).
if Ekind (T) /= E_General_Access_Type if Ekind (T) /= E_General_Access_Type
or else Ekind (Designated_Type (T)) /= E_Class_Wide_Type or else not Is_Class_Wide_Type (Designated_Type (T))
then then
if In_RCI_Declaration (Parent (T)) then if In_RCI_Declaration (Parent (T)) then
Error_Msg_N Error_Msg_N
......
...@@ -1907,12 +1907,15 @@ package body Sem_Ch7 is ...@@ -1907,12 +1907,15 @@ package body Sem_Ch7 is
if Tagged_Present (Def) then if Tagged_Present (Def) then
Set_Ekind (Id, E_Record_Type_With_Private); Set_Ekind (Id, E_Record_Type_With_Private);
Make_Class_Wide_Type (Id);
Set_Primitive_Operations (Id, New_Elmt_List); Set_Primitive_Operations (Id, New_Elmt_List);
Set_Is_Abstract_Type (Id, Abstract_Present (Def)); Set_Is_Abstract_Type (Id, Abstract_Present (Def));
Set_Is_Limited_Record (Id, Limited_Present (Def)); Set_Is_Limited_Record (Id, Limited_Present (Def));
Set_Has_Delayed_Freeze (Id, True); Set_Has_Delayed_Freeze (Id, True);
-- Create a class-wide type with the same attributes.
Make_Class_Wide_Type (Id);
elsif Abstract_Present (Def) then elsif Abstract_Present (Def) then
Error_Msg_N ("only a tagged type can be abstract", N); Error_Msg_N ("only a tagged type can be abstract", N);
end if; end if;
......
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