]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorJavier Miranda <miranda@adacore.com>
Fri, 18 Jun 2010 15:59:27 +0000 (15:59 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 18 Jun 2010 15:59:27 +0000 (17:59 +0200)
2010-06-18  Javier Miranda  <miranda@adacore.com>

* exp_cg.adb (Homonym_Suffix_Length): Minor code reorganization.

2010-06-18  Thomas Quinot  <quinot@adacore.com>

* sprint.ads: Minor reformatting.
* output.ads: Update obsolete comment.

2010-06-18  Ed Schonberg  <schonberg@adacore.com>

* freeze.adb (Build_And_Analyze_Renamed_Body): if the renamed entity is
an external intrinsic operation (e.g. a GCC numeric function) indicate
that the renaming entity has the same characteristics, so a call to it
is properly expanded.

From-SVN: r161003

gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/exp_cg.adb
gcc/ada/gcc-interface/misc.c

index 30b6acb8661680dde51ac314f186de36b08aa6f0..ef18f42cf69459e06063e6341b31425942b76ad6 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-18  Javier Miranda  <miranda@adacore.com>
+
+       * exp_cg.adb: Code clean up.
+       * debug.adb: Complete documentation of switch -gnatd.Z.
+       * gcc-interface/misc.c (callgraph_info_file): Declare.
+
 2010-06-18  Javier Miranda  <miranda@adacore.com>
 
        * exp_cg.adb (Homonym_Suffix_Length): Minor code reorganization.
index 3032267a1c1bee39dce9ef3d740d8d064a4d7948..5f7f26b0723be8b5ad83754cea8d51fbb1f09472 100644 (file)
@@ -596,6 +596,10 @@ package body Debug is
    --       case of the gcc back end. Provided as a back up in case the new
    --       scheme has problems.
 
+   --  d.Z  This flag enables the frontend call-graph output associated with
+   --       dispatching calls. Available only during the development of this
+   --       new output.
+
    --  d1   Error messages have node numbers where possible. Normally error
    --       messages have only source locations. This option is useful when
    --       debugging errors caused by expanded code, where the source location
index d207a3c21e16b44124979f2167068d8a26e6817a..1ab11b83e68854c451154ff3d5a91eee312de576 100644 (file)
@@ -29,9 +29,6 @@ with Einfo;    use Einfo;
 with Elists;   use Elists;
 with Exp_Disp; use Exp_Disp;
 with Exp_Tss;  use Exp_Tss;
---  with Interfaces.C;
---  with Interfaces.C_Streams;
---   Why are these commented out ???
 with Lib;      use Lib;
 with Namet;    use Namet;
 with Opt;      use Opt;
@@ -42,12 +39,31 @@ with Sem_Util; use Sem_Util;
 with Sinfo;    use Sinfo;
 with Sinput;   use Sinput;
 with Snames;   use Snames;
+with System;   use System;
 with Table;
 with Uintp;    use Uintp;
 
 package body Exp_CG is
 
-   --  package ICS renames Interfaces.C_Streams;
+   --  We duplicate here some declarations from packages Interfaces.C and
+   --  Interfaces.C_Streams because adding their dependence to the frontend
+   --  causes bootstrapping problems with old versions of the compiler.
+
+   subtype FILEs is System.Address;
+   --  Corresponds to the C type FILE*
+
+   subtype C_chars is System.Address;
+   --  Pointer to null-terminated array of characters
+
+   function fputs (Strng : C_chars; Stream : FILEs) return Integer;
+   pragma Import (C, fputs, "fputs");
+
+   --  Import the file stream associated with the "ci" output file. Done to
+   --  generate the output in the file created and left opened by routine
+   --  toplev.c before calling gnat1drv.
+
+   Callgraph_Info_File : FILEs;
+   pragma Import (C, Callgraph_Info_File);
 
    package Call_Graph_Nodes is new Table.Table (
       Table_Component_Type => Node_Id,
@@ -56,7 +72,10 @@ package body Exp_CG is
       Table_Initial        => 50,
       Table_Increment      => 100,
       Table_Name           => "Call_Graph_Nodes");
-   --  Document this table! ???
+   --  This table records nodes associated with dispatching calls and tagged
+   --  type declarations found in the main compilation unit. Used as an
+   --  auxiliary storage because the call-graph output requires fully qualified
+   --  names and they are not available until the backend is called.
 
    function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
    --  Determines if E is a predefined primitive operation.
@@ -88,7 +107,12 @@ package body Exp_CG is
       N : Node_Id;
 
    begin
-      if not Debug_Flag_Dot_Z then
+      --  No output if the "ci" output file has not been previously opened
+      --  by toplev.c. Temporarily the output is also disabled with -gnatd.Z
+
+      if Callgraph_Info_File = Null_Address
+        or else not Debug_Flag_Dot_ZZ
+      then
          return;
       end if;
 
@@ -330,27 +354,16 @@ package body Exp_CG is
    -- Write_Output --
    ------------------
 
---  This functionality has been temporarily disabled because bootstrapping the
---  compiler with old versions requires no dependency on package Interfaces.C
-
-   --  Import the file stream associated with the "ci" output file. Done to
-   --  generate the output in the file created and left opened by routine
-   --  toplev.c before calling gnat1drv.
-
---   Callgraph_Info_File : ICS.FILEs;
---   pragma Import (C, Callgraph_Info_File);
-
---   procedure Write_Output (Str : String) is
---      Line  : constant Interfaces.C.char_array := Interfaces.C.To_C (Str);
---      Errno : ICS.int;
---   begin
---      Errno := ICS.fputs (Line'Address, Callgraph_Info_File);
---      pragma Assert (Errno = 0);
---   end Write_Output;
-
    procedure Write_Output (Str : String) is
+      Nul   : constant Character := Character'First;
+      Line  : String (Str'First .. Str'Last + 1);
+      Errno : Integer;
    begin
-      null;
+      --  Add the null character to the string as required by fputs
+
+      Line  := Str & Nul;
+      Errno := fputs (Line'Address, Callgraph_Info_File);
+      pragma Assert (Errno >= 0);
    end Write_Output;
 
    ---------------------
index 229663b7ce206347bffe458937ecd219942f9cce..3716f1a631f7b1c9ac5869ab0f5aca6f1f55079f 100644 (file)
@@ -135,6 +135,9 @@ static tree gnat_eh_personality             (void);
 
 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
+/* This symbol needs to be defined for the front-end.  */
+void *callgraph_info_file = NULL;
+
 /* How much we want of our DWARF extensions.  Some of our dwarf+ extensions
    are incompatible with regular GDB versions, so we must make sure to only
    produce them on explicit request.  This is eventually reflected into the