Commit 2cd6f54e by Thomas Quinot Committed by Arnaud Charlet

exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Do not attempt to…

exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Do not attempt to generate stubs for hidden primitive operations.

2007-10-15  Thomas Quinot  <quinot@adacore.com>

	* exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Do not
	attempt to generate stubs for hidden primitive operations.

From-SVN: r129325
parent 3c2c15ab
...@@ -877,6 +877,8 @@ package body Exp_Dist is ...@@ -877,6 +877,8 @@ package body Exp_Dist is
Subp_Stubs : Node_Id; Subp_Stubs : Node_Id;
Subp_Str : String_Id; Subp_Str : String_Id;
pragma Warnings (Off, Subp_Str);
begin begin
-- The first thing added is an instantiation of the generic package -- The first thing added is an instantiation of the generic package
-- System.Partition_Interface.RCI_Locator with the name of this remote -- System.Partition_Interface.RCI_Locator with the name of this remote
...@@ -900,15 +902,14 @@ package body Exp_Dist is ...@@ -900,15 +902,14 @@ package body Exp_Dist is
PolyORB_Support.Reserve_NamingContext_Methods; PolyORB_Support.Reserve_NamingContext_Methods;
Current_Declaration := First (Visible_Declarations (Pkg_Spec)); Current_Declaration := First (Visible_Declarations (Pkg_Spec));
while Present (Current_Declaration) loop while Present (Current_Declaration) loop
if Nkind (Current_Declaration) = N_Subprogram_Declaration if Nkind (Current_Declaration) = N_Subprogram_Declaration
and then Comes_From_Source (Current_Declaration) and then Comes_From_Source (Current_Declaration)
then then
Assign_Subprogram_Identifier ( Assign_Subprogram_Identifier
Defining_Unit_Name (Specification (Current_Declaration)), (Defining_Unit_Name (Specification (Current_Declaration)),
Current_Subprogram_Number, Current_Subprogram_Number,
Subp_Str); Subp_Str);
Subp_Stubs := Subp_Stubs :=
Build_Subprogram_Calling_Stubs ( Build_Subprogram_Calling_Stubs (
...@@ -952,9 +953,9 @@ package body Exp_Dist is ...@@ -952,9 +953,9 @@ package body Exp_Dist is
(Loc : Source_Ptr; (Loc : Source_Ptr;
Parameter : Entity_Id; Parameter : Entity_Id;
Constrained : Boolean) return Node_Id; Constrained : Boolean) return Node_Id;
-- Return an expression that denotes the parameter passing -- Return an expression that denotes the parameter passing mode to be
-- mode to be used for Parameter in distribution stubs, -- used for Parameter in distribution stubs, where Constrained is
-- where Constrained is Parameter's constrained status. -- Parameter's constrained status.
---------------------------- ----------------------------
-- Parameter_Passing_Mode -- -- Parameter_Passing_Mode --
...@@ -1263,7 +1264,9 @@ package body Exp_Dist is ...@@ -1263,7 +1264,9 @@ package body Exp_Dist is
Current_Primitive := Node (Current_Primitive_Elmt); Current_Primitive := Node (Current_Primitive_Elmt);
-- Copy the primitive of all the parents, except predefined ones -- Copy the primitive of all the parents, except predefined ones
-- that are not remotely dispatching. -- that are not remotely dispatching. Also omit hidden primitives
-- (occurs in the case of primitives of interface progenitors
-- other than immediate ancestors of the Designated_Type).
if Chars (Current_Primitive) /= Name_uSize if Chars (Current_Primitive) /= Name_uSize
and then Chars (Current_Primitive) /= Name_uAlignment and then Chars (Current_Primitive) /= Name_uAlignment
...@@ -1273,6 +1276,7 @@ package body Exp_Dist is ...@@ -1273,6 +1276,7 @@ package body Exp_Dist is
Is_TSS (Current_Primitive, TSS_Stream_Output) or else Is_TSS (Current_Primitive, TSS_Stream_Output) or else
Is_TSS (Current_Primitive, TSS_Stream_Read) or else Is_TSS (Current_Primitive, TSS_Stream_Read) or else
Is_TSS (Current_Primitive, TSS_Stream_Write)) Is_TSS (Current_Primitive, TSS_Stream_Write))
and then not Is_Hidden (Current_Primitive)
then then
-- The first thing to do is build an up-to-date copy of the -- The first thing to do is build an up-to-date copy of the
-- spec with all the formals referencing Designated_Type -- spec with all the formals referencing Designated_Type
...@@ -2447,6 +2451,8 @@ package body Exp_Dist is ...@@ -2447,6 +2451,8 @@ package body Exp_Dist is
Current_Subp_Str : String_Id; Current_Subp_Str : String_Id;
Current_Subp_Number : Int := First_RCI_Subprogram_Id; Current_Subp_Number : Int := First_RCI_Subprogram_Id;
pragma Warnings (Off, Current_Subp_Str);
begin begin
-- Build_Subprogram_Id is called outside of the context of -- Build_Subprogram_Id is called outside of the context of
-- generating calling or receiving stubs. Hence we are processing -- generating calling or receiving stubs. Hence we are processing
...@@ -3748,8 +3754,9 @@ package body Exp_Dist is ...@@ -3748,8 +3754,9 @@ package body Exp_Dist is
-- case statement will be made on the Subprogram_Id to dispatch -- case statement will be made on the Subprogram_Id to dispatch
-- to the right subprogram. -- to the right subprogram.
All_Calls_Remote_E := Boolean_Literals ( All_Calls_Remote_E :=
Has_All_Calls_Remote (Defining_Entity (Pkg_Spec))); Boolean_Literals
(Has_All_Calls_Remote (Defining_Entity (Pkg_Spec)));
Overload_Counter_Table.Reset; Overload_Counter_Table.Reset;
...@@ -3759,8 +3766,7 @@ package body Exp_Dist is ...@@ -3759,8 +3766,7 @@ package body Exp_Dist is
and then Comes_From_Source (Current_Declaration) and then Comes_From_Source (Current_Declaration)
then then
declare declare
Loc : constant Source_Ptr := Loc : constant Source_Ptr := Sloc (Current_Declaration);
Sloc (Current_Declaration);
-- While specifically processing Current_Declaration, use -- While specifically processing Current_Declaration, use
-- its Sloc as the location of all generated nodes. -- its Sloc as the location of all generated nodes.
...@@ -3769,6 +3775,7 @@ package body Exp_Dist is ...@@ -3769,6 +3775,7 @@ package body Exp_Dist is
(Specification (Current_Declaration)); (Specification (Current_Declaration));
Subp_Val : String_Id; Subp_Val : String_Id;
pragma Warnings (Off, Subp_Val);
begin begin
-- Build receiving stub -- Build receiving stub
...@@ -3787,22 +3794,19 @@ package body Exp_Dist is ...@@ -3787,22 +3794,19 @@ package body Exp_Dist is
-- Build RAS proxy -- Build RAS proxy
Add_RAS_Proxy_And_Analyze (Decls, Add_RAS_Proxy_And_Analyze (Decls,
Vis_Decl => Vis_Decl => Current_Declaration,
Current_Declaration, All_Calls_Remote_E => All_Calls_Remote_E,
All_Calls_Remote_E => Proxy_Object_Addr => Proxy_Object_Addr);
All_Calls_Remote_E,
Proxy_Object_Addr =>
Proxy_Object_Addr);
-- Compute distribution identifier -- Compute distribution identifier
Assign_Subprogram_Identifier ( Assign_Subprogram_Identifier
Subp_Def, (Subp_Def,
Current_Subprogram_Number, Current_Subprogram_Number,
Subp_Val); Subp_Val);
pragma Assert (Current_Subprogram_Number = pragma Assert
Get_Subprogram_Id (Subp_Def)); (Current_Subprogram_Number = Get_Subprogram_Id (Subp_Def));
-- Add subprogram descriptor (RCI_Subp_Info) to the -- Add subprogram descriptor (RCI_Subp_Info) to the
-- subprograms table for this receiver. The aggregate -- subprograms table for this receiver. The aggregate
...@@ -7029,8 +7033,7 @@ package body Exp_Dist is ...@@ -7029,8 +7033,7 @@ package body Exp_Dist is
and then Comes_From_Source (Current_Declaration) and then Comes_From_Source (Current_Declaration)
then then
declare declare
Loc : constant Source_Ptr := Loc : constant Source_Ptr := Sloc (Current_Declaration);
Sloc (Current_Declaration);
-- While specifically processing Current_Declaration, use -- While specifically processing Current_Declaration, use
-- its Sloc as the location of all generated nodes. -- its Sloc as the location of all generated nodes.
...@@ -7455,7 +7458,6 @@ package body Exp_Dist is ...@@ -7455,7 +7458,6 @@ package body Exp_Dist is
Current_Parameter := First (Ordered_Parameters_List); Current_Parameter := First (Ordered_Parameters_List);
while Present (Current_Parameter) loop while Present (Current_Parameter) loop
if Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type) then if Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type) then
Is_Controlling_Formal := True; Is_Controlling_Formal := True;
Is_First_Controlling_Formal := Is_First_Controlling_Formal :=
...@@ -8522,10 +8524,12 @@ package body Exp_Dist is ...@@ -8522,10 +8524,12 @@ package body Exp_Dist is
Item := First (CI); Item := First (CI);
while Present (Item) loop while Present (Item) loop
Def := Defining_Identifier (Item); Def := Defining_Identifier (Item);
if not Is_Internal_Name (Chars (Def)) then if not Is_Internal_Name (Chars (Def)) then
Add_Process_Element Add_Process_Element
(Stmts, Container, Counter, Rec, Def); (Stmts, Container, Counter, Rec, Def);
end if; end if;
Next (Item); Next (Item);
end loop; end loop;
...@@ -8861,7 +8865,6 @@ package body Exp_Dist is ...@@ -8861,7 +8865,6 @@ package body Exp_Dist is
Alt_List)); Alt_List));
Variant := First_Non_Pragma (Variants (Field)); Variant := First_Non_Pragma (Variants (Field));
while Present (Variant) loop while Present (Variant) loop
Choice_List := New_Copy_List_Tree Choice_List := New_Copy_List_Tree
(Discrete_Choices (Variant)); (Discrete_Choices (Variant));
...@@ -8898,15 +8901,17 @@ package body Exp_Dist is ...@@ -8898,15 +8901,17 @@ package body Exp_Dist is
-- First all discriminants -- First all discriminants
if Has_Discriminants (Typ) then if Has_Discriminants (Typ) then
Disc := First_Discriminant (Typ);
Discriminant_Associations := New_List; Discriminant_Associations := New_List;
Disc := First_Discriminant (Typ);
while Present (Disc) loop while Present (Disc) loop
declare declare
Disc_Var_Name : constant Entity_Id := Disc_Var_Name : constant Entity_Id :=
Make_Defining_Identifier (Loc, Chars (Disc)); Make_Defining_Identifier (Loc,
Disc_Type : constant Entity_Id := Chars => Chars (Disc));
Etype (Disc); Disc_Type : constant Entity_Id :=
Etype (Disc);
begin begin
Append_To (Decls, Append_To (Decls,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -8936,11 +8941,12 @@ package body Exp_Dist is ...@@ -8936,11 +8941,12 @@ package body Exp_Dist is
Next_Discriminant (Disc); Next_Discriminant (Disc);
end loop; end loop;
Res_Definition := Make_Subtype_Indication (Loc, Res_Definition :=
Subtype_Mark => Res_Definition, Make_Subtype_Indication (Loc,
Constraint => Subtype_Mark => Res_Definition,
Make_Index_Or_Discriminant_Constraint (Loc, Constraint =>
Discriminant_Associations)); Make_Index_Or_Discriminant_Constraint (Loc,
Discriminant_Associations));
end if; end if;
-- Now we have all the discriminants in variables, we can -- Now we have all the discriminants in variables, we can
...@@ -9000,12 +9006,12 @@ package body Exp_Dist is ...@@ -9000,12 +9006,12 @@ package body Exp_Dist is
Expression => Empty); Expression => Empty);
Element_Any : Node_Id; Element_Any : Node_Id;
begin
begin
declare declare
Element_TC : Node_Id; Element_TC : Node_Id;
begin
begin
if Etype (Datum) = RTE (RE_Any) then if Etype (Datum) = RTE (RE_Any) then
-- When Datum is an Any the Etype field is not -- When Datum is an Any the Etype field is not
...@@ -9066,10 +9072,15 @@ package body Exp_Dist is ...@@ -9066,10 +9072,15 @@ package body Exp_Dist is
else else
Set_Expression (Assignment, Element_Any); Set_Expression (Assignment, Element_Any);
end if; end if;
Prepend_To (Stmts, Assignment); Prepend_To (Stmts, Assignment);
end if; end if;
end FA_Ary_Add_Process_Element; end FA_Ary_Add_Process_Element;
------------------------
-- Local Declarations --
------------------------
Counter : constant Entity_Id := Counter : constant Entity_Id :=
Make_Defining_Identifier (Loc, Name_J); Make_Defining_Identifier (Loc, Name_J);
...@@ -9350,14 +9361,14 @@ package body Exp_Dist is ...@@ -9350,14 +9361,14 @@ package body Exp_Dist is
Start_String; Start_String;
Store_String_Chars ("DSA:"); Store_String_Chars ("DSA:");
Get_Library_Unit_Name_String (Scope (E)); Get_Library_Unit_Name_String (Scope (E));
Store_String_Chars ( Store_String_Chars
Name_Buffer (Name_Buffer'First (Name_Buffer (Name_Buffer'First ..
.. Name_Buffer'First + Name_Len - 1)); Name_Buffer'First + Name_Len - 1));
Store_String_Char ('.'); Store_String_Char ('.');
Get_Name_String (Chars (E)); Get_Name_String (Chars (E));
Store_String_Chars ( Store_String_Chars
Name_Buffer (Name_Buffer'First (Name_Buffer (Name_Buffer'First ..
.. Name_Buffer'First + Name_Len - 1)); Name_Buffer'First + Name_Len - 1));
Store_String_Chars (":1.0"); Store_String_Chars (":1.0");
Repo_Id_Str := End_String; Repo_Id_Str := End_String;
Name_Str := String_From_Name_Buffer; Name_Str := String_From_Name_Buffer;
...@@ -9375,22 +9386,19 @@ package body Exp_Dist is ...@@ -9375,22 +9386,19 @@ package body Exp_Dist is
Typ : Entity_Id := Etype (N); Typ : Entity_Id := Etype (N);
U_Type : Entity_Id; U_Type : Entity_Id;
Fnam : Entity_Id := Empty; Fnam : Entity_Id := Empty;
Lib_RE : RE_Id := RE_Null; Lib_RE : RE_Id := RE_Null;
begin begin
-- If N is a selected component, then maybe its Etype has not been -- If N is a selected component, then maybe its Etype has not been
-- set yet: try to use the Etype of the selector_name in that -- set yet: try to use Etype of the selector_name in that case.
-- case.
if No (Typ) and then Nkind (N) = N_Selected_Component then if No (Typ) and then Nkind (N) = N_Selected_Component then
Typ := Etype (Selector_Name (N)); Typ := Etype (Selector_Name (N));
end if; end if;
pragma Assert (Present (Typ)); pragma Assert (Present (Typ));
-- The full view, if Typ is private; the completion, if Typ is -- Get full view for private type, completion for incomplete type
-- incomplete.
U_Type := Underlying_Type (Typ); U_Type := Underlying_Type (Typ);
...@@ -9824,19 +9832,20 @@ package body Exp_Dist is ...@@ -9824,19 +9832,20 @@ package body Exp_Dist is
begin begin
-- Records are encoded in a TC_STRUCT aggregate: -- Records are encoded in a TC_STRUCT aggregate:
-- -- Outer aggregate (TC_STRUCT) -- -- Outer aggregate (TC_STRUCT)
-- | [discriminant1] -- | [discriminant1]
-- | [discriminant2] -- | [discriminant2]
-- | ... -- | ...
-- -- |
-- | [component1] -- | [component1]
-- | [component2] -- | [component2]
-- | ... -- | ...
--
-- A component can be a common component or a variant -- A component can be a common component or variant part
-- part.
--
-- A variant part is encoded as a TC_UNION aggregate: -- A variant part is encoded as a TC_UNION aggregate:
-- -- Variant Part Aggregate (TC_UNION) -- -- Variant Part Aggregate (TC_UNION)
-- | [discriminant choice for this Variant Part] -- | [discriminant choice for this Variant Part]
-- | -- |
...@@ -9845,20 +9854,20 @@ package body Exp_Dist is ...@@ -9845,20 +9854,20 @@ package body Exp_Dist is
-- | | [component2] -- | | [component2]
-- | | ... -- | | ...
-- Let's start by building the outer aggregate -- Let's start by building the outer aggregate. First we
-- First we construct an Elements array containing all -- construct Elements array containing all discriminants.
-- the discriminants.
if Has_Discriminants (Typ) then if Has_Discriminants (Typ) then
Disc := First_Discriminant (Typ); Disc := First_Discriminant (Typ);
while Present (Disc) loop while Present (Disc) loop
declare declare
Discriminant : constant Entity_Id := Discriminant : constant Entity_Id :=
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => Expr_Parameter, Prefix =>
Selector_Name => Chars (Disc)); Expr_Parameter,
Selector_Name =>
Chars (Disc));
begin begin
Set_Etype (Discriminant, Etype (Disc)); Set_Etype (Discriminant, Etype (Disc));
...@@ -9869,6 +9878,7 @@ package body Exp_Dist is ...@@ -9869,6 +9878,7 @@ package body Exp_Dist is
Expression => Expression =>
Build_To_Any_Call (Discriminant, Decls))); Build_To_Any_Call (Discriminant, Decls)));
end; end;
Counter := Counter + 1; Counter := Counter + 1;
Next_Discriminant (Disc); Next_Discriminant (Disc);
end loop; end loop;
......
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