From: Hristian Kirtchev Date: Mon, 20 Apr 2009 12:35:50 +0000 (+0200) Subject: exp_ch3.adb (Make_Predefined_Primitive_Specs, [...]): Do not create the declarations... X-Git-Tag: releases/gcc-4.5.0~6359 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=451800a05775791230db1793e575296eae3b98bc;p=thirdparty%2Fgcc.git exp_ch3.adb (Make_Predefined_Primitive_Specs, [...]): Do not create the declarations and bodies of the primitive subprograms... * exp_ch3.adb (Make_Predefined_Primitive_Specs, Predefined_Primitive_Bodies): Do not create the declarations and bodies of the primitive subprograms associated with dispatching select statements when the runtime is in configurable mode. From-SVN: r146407 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ddab7af9bf54..de647ba2ef45 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -32,7 +32,7 @@ 2009-04-20 Ed Schonberg - * sem_ch8,adb (Analyze_Object_Renaming): Reject ambiguous expressions + * sem_ch8.adb (Analyze_Object_Renaming): Reject ambiguous expressions in an object renaming declaration when the expected type is an anonymous access type. diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 3af685d1a9bc..8b70aeb446b3 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7500,14 +7500,15 @@ package body Exp_Ch3 is (Tag_Typ : Entity_Id; Decl_List : out List_Id) is - Loc : constant Source_Ptr := Sloc (Tag_Typ); - Formal : Entity_Id; - Formal_List : List_Id; - Parent_Subp : Entity_Id; - Prim_Elmt : Elmt_Id; - Proc_Spec : Node_Id; - Proc_Decl : Node_Id; - Subp : Entity_Id; + Loc : constant Source_Ptr := Sloc (Tag_Typ); + + Formal : Entity_Id; + Formal_List : List_Id; + New_Param_Spec : Node_Id; + Parent_Subp : Entity_Id; + Prim_Elmt : Elmt_Id; + Proc_Decl : Node_Id; + Subp : Entity_Id; function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean; -- Returns True if E is a null procedure that is an interface primitive @@ -7549,33 +7550,52 @@ package body Exp_Ch3 is Formal_List := New_List; while Present (Formal) loop - Append - (Make_Parameter_Specification (Loc, - Defining_Identifier => - Make_Defining_Identifier (Sloc (Formal), - Chars => Chars (Formal)), - In_Present => In_Present (Parent (Formal)), - Out_Present => Out_Present (Parent (Formal)), - Null_Exclusion_Present => - Null_Exclusion_Present (Parent (Formal)), - Parameter_Type => - New_Occurrence_Of (Etype (Formal), Loc), - Expression => - New_Copy_Tree (Expression (Parent (Formal)))), - Formal_List); + + -- Copy the parameter spec including default expressions + + New_Param_Spec := + New_Copy_Tree (Parent (Formal), New_Sloc => Loc); + + -- Generate a new defining identifier for the new formal. + -- required because New_Copy_Tree does not duplicate + -- semantic fields (except itypes). + + Set_Defining_Identifier (New_Param_Spec, + Make_Defining_Identifier (Sloc (Formal), + Chars => Chars (Formal))); + + -- For controlling arguments we must change their + -- parameter type to reference the tagged type (instead + -- of the interface type) + + if Is_Controlling_Formal (Formal) then + if Nkind (Parameter_Type (Parent (Formal))) + = N_Identifier + then + Set_Parameter_Type (New_Param_Spec, + New_Occurrence_Of (Tag_Typ, Loc)); + + else pragma Assert + (Nkind (Parameter_Type (Parent (Formal))) + = N_Access_Definition); + Set_Subtype_Mark (Parameter_Type (New_Param_Spec), + New_Occurrence_Of (Tag_Typ, Loc)); + end if; + end if; + + Append (New_Param_Spec, Formal_List); Next_Formal (Formal); end loop; end if; - Proc_Spec := - Make_Procedure_Specification (Loc, - Defining_Unit_Name => - Make_Defining_Identifier (Loc, Chars (Subp)), - Parameter_Specifications => Formal_List); - Set_Null_Present (Proc_Spec); - - Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec); + Proc_Decl := + Make_Subprogram_Declaration (Loc, + Make_Procedure_Specification (Loc, + Defining_Unit_Name => + Make_Defining_Identifier (Loc, Chars (Subp)), + Parameter_Specifications => Formal_List, + Null_Present => True)); Append_To (Decl_List, Proc_Decl); Analyze (Proc_Decl); end if;