diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-24 12:11:52 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-24 12:11:52 +0200 |
commit | e1f3cb584d01e98206cea8feeb094ca025534ff7 (patch) | |
tree | 93566d15728270f04bb11663b8d930f136b389a4 /gcc/ada/exp_ch6.adb | |
parent | c928785785d29202b33a7738adecff9a09c93738 (diff) | |
download | gcc-e1f3cb584d01e98206cea8feeb094ca025534ff7.zip gcc-e1f3cb584d01e98206cea8feeb094ca025534ff7.tar.gz gcc-e1f3cb584d01e98206cea8feeb094ca025534ff7.tar.bz2 |
[multiple changes]
2009-06-24 Robert Dewar <dewar@adacore.com>
* prj-nmsc.adb, prj-nmsc.ads, prj-proc.adb, prj.adb: Minor reformatting
* a-strsea.adb (Count): Avoid local copy on stack, speed up unmapped
case.
(Index): Ditto.
2009-06-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_One_Call): Check that at least one actual is
present when checking whether a call may be interpreted as an indexing
of the result of a call.
* exp_ch9.adb (Expand_N_Subprogram_Declaration): Place the generated
body for a null procedure on the freeze actions for the procedure, so
that it will be analyzed at the proper place without premature freezing
of actuals.
* sem_ch3.adb (Check_Completion): Code cleanup.
Do not diagnose a null procedure without a body, if previous errors
have disabled expansion.
2009-06-24 Doug Rupp <rupp@adacore.com>
* init.c [VMS] Resignal C$_SIGKILL
2009-06-24 Ed Falis <falis@adacore.com>
* s-vxwext.adb, s-vxwext-kernel.adb: Add s-vxwext body for VxWorks 5
Define ERROR in body for VxWorks 6 kernel
2009-06-24 Pascal Obry <obry@adacore.com>
* g-socket.adb, g-socket.ads: Fix possible unexpected constraint error
in [Send/Receive]_Socket.
From-SVN: r148905
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 011472d..0b4ea23 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -4440,35 +4440,24 @@ package body Exp_Ch6 is Pop_Scope; end if; - -- Ada 2005 (AI-348): Generation of the null body + -- Ada 2005 (AI-348): Generate body for a null procedure. + -- In most cases this is superfluous because calls to it + -- will be automatically inlined, but we definitely need + -- the body if preconditions for the procedure are present. elsif Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) then declare - Bod : constant Node_Id := - Make_Subprogram_Body (Loc, - Specification => - New_Copy_Tree (Specification (N)), - Declarations => New_List, - Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, - Statements => New_List (Make_Null_Statement (Loc)))); + Bod : constant Node_Id := Body_To_Inline (N); begin - Set_Body_To_Inline (N, Bod); - Insert_After (N, Bod); - Analyze (Bod); + Set_Has_Completion (Subp, False); + Append_Freeze_Action (Subp, Bod); - -- Corresponding_Spec isn't being set by Analyze_Subprogram_Body, - -- evidently because Set_Has_Completion is called earlier for null - -- procedures in Analyze_Subprogram_Declaration, so we force its - -- setting here. If the setting of Has_Completion is not set - -- earlier, then it can result in missing body errors if other - -- errors were already reported (since expansion is turned off). + -- The body now contains raise statements, so calls to it will + -- not be inlined. - -- Should creation of the empty body be moved to the analyzer??? - - Set_Corresponding_Spec (Bod, Defining_Entity (Specification (N))); + Set_Is_Inlined (Subp, False); end; end if; end Expand_N_Subprogram_Declaration; @@ -4910,8 +4899,8 @@ package body Exp_Ch6 is -- Check if this is a declared null procedure elsif Nkind (Decl) = N_Subprogram_Declaration then - if Null_Present (Specification (Decl)) then - return True; + if not Null_Present (Specification (Decl)) then + return False; elsif No (Body_To_Inline (Decl)) then return False; @@ -4936,8 +4925,9 @@ package body Exp_Ch6 is Stat2 := Next (Stat); return - Nkind (Stat) = N_Null_Statement - and then + Is_Empty_List (Declarations (Orig_Bod)) + and then Nkind (Stat) = N_Null_Statement + and then (No (Stat2) or else (Nkind (Stat2) = N_Simple_Return_Statement |