diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-22 15:07:18 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-22 15:07:18 +0000 |
commit | 68e249dbfaec88c87d410233adf6332fddfb840b (patch) | |
tree | 88471146f4dca476c99d4275f21aa6f42f44848a /gcc/ada | |
parent | f815903c6d269b99b24566510f9c5c5f09240fe7 (diff) | |
download | gcc-68e249dbfaec88c87d410233adf6332fddfb840b.tar.gz |
2008-08-22 Javier Miranda <miranda@adacore.com>
* exp_ch3.adb (Build_Init_Statements): Transfer to the body of the
init procedure all the expanded code associated with the spec of
task types and protected types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_ch3.adb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 5a49cd0568b..f2b3eaff0e3 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -2515,6 +2515,47 @@ package body Exp_Ch3 is Statement_List := New_List; + -- Loop through visible declarations of task types and protected + -- types moving any expanded code from the spec to the body of the + -- init procedure + + if Is_Task_Record_Type (Rec_Type) + or else Is_Protected_Record_Type (Rec_Type) + then + declare + Decl : constant Node_Id := + Parent (Corresponding_Concurrent_Type (Rec_Type)); + Def : Node_Id; + N1 : Node_Id; + N2 : Node_Id; + + begin + if Is_Task_Record_Type (Rec_Type) then + Def := Task_Definition (Decl); + else + Def := Protected_Definition (Decl); + end if; + + if Present (Def) then + N1 := First (Visible_Declarations (Def)); + while Present (N1) loop + N2 := N1; + N1 := Next (N1); + + if Nkind (N2) in N_Statement_Other_Than_Procedure_Call + or else Nkind (N2) in N_Raise_xxx_Error + or else Nkind (N2) = N_Procedure_Call_Statement + then + Append_To (Statement_List, + New_Copy_Tree (N2, New_Scope => Proc_Id)); + Rewrite (N2, Make_Null_Statement (Sloc (N2))); + Analyze (N2); + end if; + end loop; + end if; + end; + end if; + -- Loop through components, skipping pragmas, in 2 steps. The first -- step deals with regular components. The second step deals with -- components have per object constraints, and no explicit initia- |