OSDN Git Service

2010-09-10 Doug Rupp <rupp@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 2010 13:40:50 +0000 (13:40 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 2010 13:40:50 +0000 (13:40 +0000)
* bindgen.adb: Minor comment fix for -H switch.

2010-09-10  Ed Schonberg  <schonberg@adacore.com>

* exp_cg.adb (Register_CG_Node): Determine enclosing subprogram or
library unit now, by traversing tree before context is expanded.
(Write_Call_Info): Use enclosing unit name directly.
* exp_ch9.adb (Expand_N_Accept_Statement): Attach generated block to
tree earlier, to ensure that subsequent declarations are analyzed in a
connected structure.
* exp_intr.adb (Expand_Unc_Deallocation): Ditto for generated statement
list.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164173 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/bindgen.adb
gcc/ada/exp_cg.adb
gcc/ada/exp_ch9.adb
gcc/ada/exp_intr.adb

index 057ddff..da9e0c0 100644 (file)
@@ -1,3 +1,18 @@
+2010-09-10  Doug Rupp  <rupp@adacore.com>
+
+       * bindgen.adb: Minor comment fix for -H switch.
+
+2010-09-10  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_cg.adb (Register_CG_Node): Determine enclosing subprogram or
+       library unit now, by traversing tree before context is expanded.
+       (Write_Call_Info): Use enclosing unit name directly.
+       * exp_ch9.adb (Expand_N_Accept_Statement): Attach generated block to
+       tree earlier, to ensure that subsequent declarations are analyzed in a
+       connected structure.
+       * exp_intr.adb (Expand_Unc_Deallocation): Ditto for generated statement
+       list.
+
 2010-09-10  Robert Dewar  <dewar@adacore.com>
 
        * symbols-processing-vms-alpha.adb: Minor reformatting.
index 6d1642d..df47274 100644 (file)
@@ -139,7 +139,7 @@ package body Bindgen is
 
    --  Heap_Size is the heap to use for memory allocations set by use of a
    --  -Hnn parameter for the binder or by the GNAT$NO_MALLOC_64 logical.
-   --  Valid values are 32 and 64. This switch is only available on VMS.
+   --  Valid values are 32 and 64. This switch is only effective on VMS.
 
    --  WC_Encoding shows the wide character encoding method used for the main
    --  program. This is one of the encoding letters defined in
index e7decc8..aad5157 100644 (file)
@@ -193,7 +193,7 @@ package body Exp_CG is
                declare
                   Result : Natural := Prefix_Length + 1;
                begin
-                  while Nr > 10 loop
+                  while Nr >= 10 loop
                      Result := Result + 1;
                      Nr := Nr / 10;
                   end loop;
@@ -324,12 +324,22 @@ package body Exp_CG is
 
             declare
                Copy : constant Node_Id := New_Copy (N);
+               Par  : Node_Id;
 
             begin
-               --  Copy the link to the parent to allow climbing up the tree
-               --  when the call-graph information is generated
+               --  Determine the enclosing scope to use when generating the
+               --  call graph. This must be done now to avoid problems with
+               --  control structures that may be rewritten during expansion.
+
+               Par := Parent (N);
+               while Nkind (Par) /= N_Subprogram_Body
+                 and then Nkind (Parent (Par)) /= N_Compilation_Unit
+               loop
+                  Par := Parent (Par);
+                  pragma Assert (Present (Par));
+               end loop;
 
-               Set_Parent (Copy, Parent (N));
+               Set_Parent (Copy, Par);
                Call_Graph_Nodes.Append (Copy);
             end;
          end if;
@@ -378,20 +388,9 @@ package body Exp_CG is
       Ctrl_Arg : constant Node_Id   := Controlling_Argument (Call);
       Ctrl_Typ : constant Entity_Id := Base_Type (Etype (Ctrl_Arg));
       Prim     : constant Entity_Id := Entity (Sinfo.Name (Call));
-      P        : Node_Id;
+      P        : constant Node_Id   := Parent (Call);
 
    begin
-      --  Locate the enclosing context: a subprogram (if available) or the
-      --  enclosing library-level package
-
-      P := Parent (Call);
-      while Nkind (P) /= N_Subprogram_Body
-        and then Nkind (Parent (P)) /= N_Compilation_Unit
-      loop
-         P := Parent (P);
-         pragma Assert (Present (P));
-      end loop;
-
       Write_Str ("edge: { sourcename: ");
       Write_Char ('"');
       Get_External_Name (Defining_Entity (P), Has_Suffix => False);
index f272b95..a91ec6a 100644 (file)
@@ -5259,6 +5259,11 @@ package body Exp_Ch9 is
              Declarations               => Declarations (N),
              Handled_Statement_Sequence => Build_Accept_Body (N));
 
+         --  For the analysis of the generated declarations, the parent node
+         --  must be properly set.
+
+         Set_Parent (Block, Parent (N));
+
          --  Prepend call to Accept_Call to main statement sequence If the
          --  accept has exception handlers, the statement sequence is wrapped
          --  in a block. Insert call and renaming declarations in the
index 0c4a67c..ecf1026 100644 (file)
@@ -1014,6 +1014,10 @@ package body Exp_Intr is
       Append_To (Stmts, Free_Node);
       Set_Storage_Pool (Free_Node, Pool);
 
+      --  Attach to tree before analysis of generated subtypes below.
+
+      Set_Parent (Stmts, Parent (N));
+
       --  Deal with storage pool
 
       if Present (Pool) then