diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-17 10:20:27 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-17 10:20:27 +0000 |
commit | ec97ce79ea2f8a65c72ffb1984442fdf0913bac5 (patch) | |
tree | 25dda74eb2894d76da5db5255fa2da7fe6051e50 /gcc/ada/exp_ch9.adb | |
parent | e0394ecaac4818b0a656b3b9d0f2d924d21db621 (diff) | |
download | gcc-ec97ce79ea2f8a65c72ffb1984442fdf0913bac5.tar.gz |
2010-06-17 Thomas Quinot <quinot@adacore.com>
* exp_imgv.adb, exp_ch7.ads: Minor reformatting.
2010-06-17 Robert Dewar <dewar@adacore.com>
* exp_ch9.adb, exp_disp.adb, exp_dist.adb: Use Make_Temporary.
2010-06-17 Thomas Quinot <quinot@adacore.com>
* sprint.adb (pg): Set Dump_Freeze_Null, to be consistent with -gnatdg.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160895 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch9.adb')
-rw-r--r-- | gcc/ada/exp_ch9.adb | 241 |
1 files changed, 97 insertions, 144 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index ac439917107..a15b7875ddb 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -1168,8 +1168,7 @@ package body Exp_Ch9 is procedure Build_Entry_Family_Name (Id : Entity_Id) is Def : constant Node_Id := Discrete_Subtype_Definition (Parent (Id)); - L_Id : constant Entity_Id := - Make_Defining_Identifier (Loc, New_Internal_Name ('L')); + L_Id : constant Entity_Id := Make_Temporary (Loc, 'L'); L_Stmts : constant List_Id := New_List; Val : Node_Id; @@ -1265,9 +1264,8 @@ package body Exp_Ch9 is Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, - Defining_Identifier => L_Id, - Discrete_Subtype_Definition => - Build_Range (Def))), + Defining_Identifier => L_Id, + Discrete_Subtype_Definition => Build_Range (Def))), Statements => L_Stmts, End_Label => Empty)); end Build_Entry_Family_Name; @@ -1411,7 +1409,7 @@ package body Exp_Ch9 is return Empty; end if; - Index := Make_Defining_Identifier (Loc, New_Internal_Name ('I')); + Index := Make_Temporary (Loc, 'I'); -- Step 1: Generate the declaration of the index variable: -- Inn : Protected_Entry_Index := 0; @@ -1428,10 +1426,8 @@ package body Exp_Ch9 is Append_To (B_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Index, - Object_Definition => - New_Reference_To (RTE (Index_Typ), Loc), - Expression => - Make_Integer_Literal (Loc, 0))); + Object_Definition => New_Reference_To (RTE (Index_Typ), Loc), + Expression => Make_Integer_Literal (Loc, 0))); B_Stmts := New_List; @@ -1488,19 +1484,15 @@ package body Exp_Ch9 is -- Generate: -- type Ann is access all <actual-type> - Comp_Nam := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Comp_Nam := Make_Temporary (Loc, 'A'); Append_To (Decls, Make_Full_Type_Declaration (Loc, - Defining_Identifier => - Comp_Nam, - Type_Definition => + Defining_Identifier => Comp_Nam, + Type_Definition => Make_Access_To_Object_Definition (Loc, - All_Present => - True, - Constant_Present => - Ekind (Formal) = E_In_Parameter, + All_Present => True, + Constant_Present => Ekind (Formal) = E_In_Parameter, Subtype_Indication => New_Reference_To (Etype (Actual), Loc)))); @@ -1525,8 +1517,7 @@ package body Exp_Ch9 is Next_Formal_With_Extras (Formal); end loop; - Rec_Nam := - Make_Defining_Identifier (Loc, New_Internal_Name ('P')); + Rec_Nam := Make_Temporary (Loc, 'P'); if Has_Comp then @@ -3104,7 +3095,7 @@ package body Exp_Ch9 is if Nkind (Op_Spec) = N_Function_Specification then if Exc_Safe then - R := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); + R := Make_Temporary (Loc, 'R'); Unprot_Call := Make_Object_Declaration (Loc, Defining_Identifier => R, @@ -3115,8 +3106,10 @@ package body Exp_Ch9 is Name => Make_Identifier (Loc, Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); - Return_Stmt := Make_Simple_Return_Statement (Loc, - Expression => New_Reference_To (R, Loc)); + + Return_Stmt := + Make_Simple_Return_Statement (Loc, + Expression => New_Reference_To (R, Loc)); else Unprot_Call := Make_Simple_Return_Statement (Loc, @@ -3489,8 +3482,8 @@ package body Exp_Ch9 is and then Ada_Version >= Ada_05 then declare - Obj : constant Entity_Id := - Make_Defining_Identifier (Loc, New_Internal_Name ('F')); + ExpR : constant Node_Id := Relocate_Node (Concval); + Obj : constant Entity_Id := Make_Temporary (Loc, 'F', ExpR); Decl : Node_Id; begin @@ -3498,7 +3491,7 @@ package body Exp_Ch9 is Make_Object_Declaration (Loc, Defining_Identifier => Obj, Object_Definition => New_Occurrence_Of (Conctyp, Loc), - Expression => Relocate_Node (Concval)); + Expression => ExpR); Set_Etype (Obj, Conctyp); Decls := New_List (Decl); Rewrite (Concval, New_Occurrence_Of (Obj, Loc)); @@ -3568,11 +3561,9 @@ package body Exp_Ch9 is if Is_By_Copy_Type (Etype (Actual)) then N_Node := Make_Object_Declaration (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('J')), - Aliased_Present => True, - Object_Definition => + Defining_Identifier => Make_Temporary (Loc, 'J'), + Aliased_Present => True, + Object_Definition => New_Reference_To (Etype (Formal), Loc)); -- Mark the object as not needing initialization since the @@ -3683,13 +3674,12 @@ package body Exp_Ch9 is -- Bnn : Communications_Block; - Comm_Name := - Make_Defining_Identifier (Loc, New_Internal_Name ('B')); + Comm_Name := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Comm_Name, - Object_Definition => + Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Some additional statements for protected entry calls @@ -3941,16 +3931,13 @@ package body Exp_Ch9 is Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); - - Blkent : Entity_Id; + Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin - Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - Block := Make_Block_Statement (Loc, - Identifier => New_Reference_To (Blkent, Loc), + Identifier => New_Reference_To (Blkent, Loc), Declarations => New_List ( -- _Chain : Activation_Chain; @@ -4006,12 +3993,10 @@ package body Exp_Ch9 is Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); - Blkent : Entity_Id; + Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin - Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - Append_To (Init_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc), @@ -4141,9 +4126,7 @@ package body Exp_Ch9 is Efam := First_Entity (Conctyp); while Present (Efam) loop if Ekind (Efam) = E_Entry_Family then - Efam_Type := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('F')); + Efam_Type := Make_Temporary (Loc, 'F'); declare Bas : Entity_Id := @@ -4158,9 +4141,7 @@ package body Exp_Ch9 is (Discrete_Subtype_Definition (Parent (Efam)), Lo, Hi); if Is_Potentially_Large_Family (Bas, Conctyp, Lo, Hi) then - Bas := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('B')); + Bas := Make_Temporary (Loc, 'B'); Bas_Decl := Make_Subtype_Declaration (Loc, @@ -4397,20 +4378,19 @@ package body Exp_Ch9 is else declare Decl : Node_Id; - T_Self : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('T')); + T_Self : constant Entity_Id := Make_Temporary (Loc, 'T'); T_Body : constant Node_Id := Parent (Corresponding_Body (Parent (Entity (N)))); begin - Decl := Make_Object_Declaration (Loc, - Defining_Identifier => T_Self, - Object_Definition => - New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), - Expression => - Make_Function_Call (Loc, - Name => New_Reference_To (RTE (RE_Self), Loc))); + Decl := + Make_Object_Declaration (Loc, + Defining_Identifier => T_Self, + Object_Definition => + New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), + Expression => + Make_Function_Call (Loc, + Name => New_Reference_To (RTE (RE_Self), Loc))); Prepend (Decl, Declarations (T_Body)); Analyze (Decl); Set_Scope (T_Self, Entity (N)); @@ -4707,25 +4687,28 @@ package body Exp_Ch9 is -- completes in the middle of the accept body. if Present (Handled_Statement_Sequence (N)) then - Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L')); - Set_Entity (Lab_Id, - Make_Defining_Identifier (Loc, Chars (Lab_Id))); - Lab := Make_Label (Loc, Lab_Id); - Ldecl := - Make_Implicit_Label_Declaration (Loc, - Defining_Identifier => Entity (Lab_Id), - Label_Construct => Lab); - Append (Lab, Statements (Handled_Statement_Sequence (N))); - - Lab_Id := Make_Identifier (Loc, New_Internal_Name ('L')); - Set_Entity (Lab_Id, - Make_Defining_Identifier (Loc, Chars (Lab_Id))); - Lab := Make_Label (Loc, Lab_Id); - Ldecl2 := - Make_Implicit_Label_Declaration (Loc, - Defining_Identifier => Entity (Lab_Id), - Label_Construct => Lab); - Append (Lab, Statements (Handled_Statement_Sequence (N))); + declare + Ent : Entity_Id; + + begin + Ent := Make_Temporary (Loc, 'L'); + Lab_Id := New_Reference_To (Ent, Loc); + Lab := Make_Label (Loc, Lab_Id); + Ldecl := + Make_Implicit_Label_Declaration (Loc, + Defining_Identifier => Ent, + Label_Construct => Lab); + Append (Lab, Statements (Handled_Statement_Sequence (N))); + + Ent := Make_Temporary (Loc, 'L'); + Lab_Id := New_Reference_To (Ent, Loc); + Lab := Make_Label (Loc, Lab_Id); + Ldecl2 := + Make_Implicit_Label_Declaration (Loc, + Defining_Identifier => Ent, + Label_Construct => Lab); + Append (Lab, Statements (Handled_Statement_Sequence (N))); + end; else Ldecl := Empty; @@ -4737,9 +4720,7 @@ package body Exp_Ch9 is if Is_List_Member (N) then if Present (Handled_Statement_Sequence (N)) then - Ann := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('A')); + Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, @@ -4796,9 +4777,7 @@ package body Exp_Ch9 is -- label for requeue expansion must be declared. if N = Accept_Statement (Alt) then - Ann := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - + Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, Defining_Identifier => Ann, @@ -4911,10 +4890,8 @@ package body Exp_Ch9 is Comps : List_Id; T : constant Entity_Id := Defining_Identifier (N); D_T : constant Entity_Id := Designated_Type (T); - D_T2 : constant Entity_Id := Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('D')); - E_T : constant Entity_Id := Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('E')); + D_T2 : constant Entity_Id := Make_Temporary (Loc, 'D'); + E_T : constant Entity_Id := Make_Temporary (Loc, 'E'); P_List : constant List_Id := Build_Protected_Spec (N, RTE (RE_Address), D_T, False); Decl1 : Node_Id; @@ -4950,8 +4927,7 @@ package body Exp_Ch9 is Comps := New_List ( Make_Component_Declaration (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, New_Internal_Name ('P')), + Defining_Identifier => Make_Temporary (Loc, 'P'), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, @@ -4959,11 +4935,10 @@ package body Exp_Ch9 is New_Occurrence_Of (RTE (RE_Address), Loc))), Make_Component_Declaration (Loc, - Defining_Identifier => - Make_Defining_Identifier (Loc, New_Internal_Name ('S')), + Defining_Identifier => Make_Temporary (Loc, 'S'), Component_Definition => Make_Component_Definition (Loc, - Aliased_Present => False, + Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (D_T2, Loc)))); Decl2 := @@ -5291,7 +5266,7 @@ package body Exp_Ch9 is -- Construct the block, using the declarations from the accept -- statement if any to initialize the declarations of the block. - Blkent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Blkent := Make_Temporary (Loc, 'A'); Set_Ekind (Blkent, E_Block); Set_Etype (Blkent, Standard_Void_Type); Set_Scope (Blkent, Current_Scope); @@ -5676,7 +5651,7 @@ package body Exp_Ch9 is T : Entity_Id; -- Additional status flag begin - Blk_Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Blk_Ent := Make_Temporary (Loc, 'A'); Ecall := Triggering_Statement (Trig); -- The arguments in the call may require dynamic allocation, and the @@ -5717,13 +5692,11 @@ package body Exp_Ch9 is -- Communication block processing, generate: -- Bnn : Communication_Block; - Bnn := Make_Defining_Identifier (Loc, New_Internal_Name ('B')); - + Bnn := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, - Defining_Identifier => - Bnn, - Object_Definition => + Defining_Identifier => Bnn, + Object_Definition => New_Reference_To (RTE (RE_Communication_Block), Loc))); -- Call kind processing, generate: @@ -5761,14 +5734,13 @@ package body Exp_Ch9 is S := Build_S (Loc, Decls); -- Additional status flag processing, generate: + -- Tnn : Boolean; - T := Make_Defining_Identifier (Loc, New_Internal_Name ('T')); - + T := Make_Temporary (Loc, 'T'); Append_To (Decls, Make_Object_Declaration (Loc, - Defining_Identifier => - T, - Object_Definition => + Defining_Identifier => T, + Object_Definition => New_Reference_To (Standard_Boolean, Loc))); ------------------------------ @@ -5853,9 +5825,7 @@ package body Exp_Ch9 is -- _clean; -- end; - Cleanup_Block_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('C')); - + Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, Bnn); @@ -5868,9 +5838,7 @@ package body Exp_Ch9 is -- when Abort_Signal => Abort_Undefer; -- end; - Abort_Block_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); - + Abort_Block_Ent := Make_Temporary (Loc, 'A'); ProtE_Stmts := New_List ( Make_Implicit_Label_Declaration (Loc, @@ -5985,9 +5953,7 @@ package body Exp_Ch9 is -- _clean; -- end; - Cleanup_Block_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('C')); - + Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, T); @@ -6000,13 +5966,11 @@ package body Exp_Ch9 is -- when Abort_Signal => Abort_Undefer; -- end; - Abort_Block_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Abort_Block_Ent := Make_Temporary (Loc, 'A'); Append_To (TaskE_Stmts, Make_Implicit_Label_Declaration (Loc, - Defining_Identifier => - Abort_Block_Ent)); + Defining_Identifier => Abort_Block_Ent)); Append_To (TaskE_Stmts, Build_Abort_Block @@ -6143,8 +6107,7 @@ package body Exp_Ch9 is -- Add a Delay_Block object to the parameter list of the delay -- procedure to form the parameter list of the Wait entry call. - Dblock_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('D')); + Dblock_Ent := Make_Temporary (Loc, 'D'); Pdef := Entity (Name (Ecall)); @@ -7092,8 +7055,7 @@ package body Exp_Ch9 is -- Declare new access type and then append - Ctype := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Ctype := Make_Temporary (Loc, 'A'); Decl := Make_Full_Type_Declaration (Loc, @@ -7120,8 +7082,7 @@ package body Exp_Ch9 is -- Create the Entry_Parameter_Record declaration - Rec_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('P')); + Rec_Ent := Make_Temporary (Loc, 'P'); Decl := Make_Full_Type_Declaration (Loc, @@ -7137,8 +7098,7 @@ package body Exp_Ch9 is -- Construct and link in the corresponding access type - Acc_Ent := - Make_Defining_Identifier (Loc, New_Internal_Name ('A')); + Acc_Ent := Make_Temporary (Loc, 'A'); Set_Entry_Parameters_Type (Entry_Ent, Acc_Ent); @@ -8751,8 +8711,7 @@ package body Exp_Ch9 is function Accept_Or_Raise return List_Id is Cond : Node_Id; Stats : List_Id; - J : constant Entity_Id := Make_Defining_Identifier (Loc, - New_Internal_Name ('J')); + J : constant Entity_Id := Make_Temporary (Loc, 'J'); begin -- We generate the following: @@ -9344,8 +9303,8 @@ package body Exp_Ch9 is -- Create Duration and Delay_Mode objects used for passing a delay -- value to RTS - D := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); - M := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); + D := Make_Temporary (Loc, 'D'); + M := Make_Temporary (Loc, 'M'); declare Discr : Entity_Id; @@ -10579,7 +10538,7 @@ package body Exp_Ch9 is New_List (New_Copy (Expression (D_Stat)))); end if; - D := Make_Defining_Identifier (Loc, New_Internal_Name ('D')); + D := Make_Temporary (Loc, 'D'); -- Generate: -- D : Duration; @@ -10591,7 +10550,7 @@ package body Exp_Ch9 is Object_Definition => New_Reference_To (Standard_Duration, Loc))); - M := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); + M := Make_Temporary (Loc, 'M'); -- Generate: -- M : Integer := (0 | 1 | 2); @@ -11370,9 +11329,7 @@ package body Exp_Ch9 is if Is_Protected then declare - Prot_Ent : constant Entity_Id := - Make_Defining_Identifier (Loc, - New_Internal_Name ('R')); + Prot_Ent : constant Entity_Id := Make_Temporary (Loc, 'R'); Prot_Typ : RE_Id; begin @@ -11561,8 +11518,7 @@ package body Exp_Ch9 is High := Replace_Bound (High); Low := Replace_Bound (Low); - Index_Typ := - Make_Defining_Identifier (Loc, New_Internal_Name ('J')); + Index_Typ := Make_Temporary (Loc, 'J'); -- Generate: -- subtype Jnn is <Etype of Index> range Low .. High; @@ -11790,9 +11746,7 @@ package body Exp_Ch9 is -- Interrupt_Priority). else - Temp := - Make_Defining_Identifier (Loc, New_Internal_Name ('R')); - + Temp := Make_Temporary (Loc, 'R', Prio); Append_To (L, Make_Object_Declaration (Loc, Defining_Identifier => Temp, @@ -11800,7 +11754,7 @@ package body Exp_Ch9 is New_Occurrence_Of (RTE (RE_Any_Priority), Loc), Expression => Relocate_Node (Prio))); - Append_To (Args, New_Occurrence_Of (Temp, Loc)); + Append_To (Args, New_Occurrence_Of (Temp, Loc)); end if; end; @@ -12380,8 +12334,7 @@ package body Exp_Ch9 is -- Generate: -- Jnn : aliased <formal-type> - Temp_Nam := - Make_Defining_Identifier (Loc, New_Internal_Name ('J')); + Temp_Nam := Make_Temporary (Loc, 'J'); Append_To (Decls, Make_Object_Declaration (Loc, @@ -12447,7 +12400,7 @@ package body Exp_Ch9 is -- <actual2>'reference; -- ...); - P := Make_Defining_Identifier (Loc, New_Internal_Name ('P')); + P := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, |