diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-09 12:17:40 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-09 12:17:40 +0200 |
commit | 7aedb36acbf75714d3b89db8ceebf9209c3dc02f (patch) | |
tree | 1c386358ddd8a840fdc3199079dff29ae8481caa | |
parent | a4941eecd0c07405fa7f5ee91d74aa6ef302df99 (diff) | |
download | gcc-7aedb36acbf75714d3b89db8ceebf9209c3dc02f.zip gcc-7aedb36acbf75714d3b89db8ceebf9209c3dc02f.tar.gz gcc-7aedb36acbf75714d3b89db8ceebf9209c3dc02f.tar.bz2 |
[multiple changes]
2009-07-09 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Freeze_Expression): If the expression is the name of a
function in a call, and the function has not been frozen yet, create
extra formals for it to ensure that the proper actuals are created
when expanding the call.
2009-07-09 Emmanuel Briot <briot@adacore.com>
* prj-pp.adb (Print): Fix handling of source index when set on a
declaration node.
From-SVN: r149408
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/freeze.adb | 14 | ||||
-rw-r--r-- | gcc/ada/prj-pp.adb | 15 |
3 files changed, 33 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 78006e5..296c04d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,17 @@ 2009-07-09 Ed Schonberg <schonberg@adacore.com> + * freeze.adb (Freeze_Expression): If the expression is the name of a + function in a call, and the function has not been frozen yet, create + extra formals for it to ensure that the proper actuals are created + when expanding the call. + +2009-07-09 Emmanuel Briot <briot@adacore.com> + + * prj-pp.adb (Print): Fix handling of source index when set on a + declaration node. + +2009-07-09 Ed Schonberg <schonberg@adacore.com> + * einfo.ads, einfo.adb: New attribute Related_Expression, used to link a temporary to the source expression whose value it captures. diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 5a7d0ef..fffb33f 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -4012,6 +4012,12 @@ package body Freeze is -- designated type is a private type without full view, the expression -- cannot contain an allocator, so the type is not frozen. + -- For a function, we freeze the entity when the subprogram declaration + -- is frozen, but a function call may appear in an initialization proc. + -- before the declaration is frozen. We need to generate the extra + -- formals, if any, to ensure that the expansion of the call includes + -- the proper actuals. + Desig_Typ := Empty; case Nkind (N) is @@ -4033,6 +4039,14 @@ package body Freeze is Desig_Typ := Designated_Type (Etype (Prefix (N))); end if; + when N_Identifier => + if Present (Nam) + and then Ekind (Nam) = E_Function + and then Nkind (Parent (N)) = N_Function_Call + then + Create_Extra_Formals (Nam); + end if; + when others => null; end case; diff --git a/gcc/ada/prj-pp.adb b/gcc/ada/prj-pp.adb index 5ddafbc..cc88f8e 100644 --- a/gcc/ada/prj-pp.adb +++ b/gcc/ada/prj-pp.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -517,7 +517,7 @@ package body Prj.PP is Output_String (String_Value_Of (Node, In_Tree)); if Source_Index_Of (Node, In_Tree) /= 0 then - Write_String (" at "); + Write_String (" at"); Write_String (Source_Index_Of (Node, In_Tree)'Img); end if; @@ -532,12 +532,6 @@ package body Prj.PP is Write_String (" ("); Output_String (Associative_Array_Index_Of (Node, In_Tree)); - - if Source_Index_Of (Node, In_Tree) /= 0 then - Write_String (" at "); - Write_String (Source_Index_Of (Node, In_Tree)'Img); - end if; - Write_String (")"); end if; @@ -580,6 +574,11 @@ package body Prj.PP is Output_Attribute_Name (Name_Of (Node, In_Tree)); end if; + if Source_Index_Of (Node, In_Tree) /= 0 then + Write_String (" at"); + Write_String (Source_Index_Of (Node, In_Tree)'Img); + end if; + Write_String (";"); Write_End_Of_Line_Comment (Node); Print (First_Comment_After (Node, In_Tree), Indent); |