aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2010-06-18 15:59:27 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-18 17:59:27 +0200
commitc88f5c498699dc01f321eafdd081ebcbdc9b538d (patch)
tree1f6a996b4edefd612d1c07c930a9077765321aa5 /gcc
parentfd7de64cee04fd08c9a849a20e9cf0fd8d6906e1 (diff)
downloadgcc-c88f5c498699dc01f321eafdd081ebcbdc9b538d.zip
gcc-c88f5c498699dc01f321eafdd081ebcbdc9b538d.tar.gz
gcc-c88f5c498699dc01f321eafdd081ebcbdc9b538d.tar.bz2
[multiple changes]
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/debug.adb4
-rw-r--r--gcc/ada/exp_cg.adb63
-rw-r--r--gcc/ada/gcc-interface/misc.c3
4 files changed, 51 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 30b6acb..ef18f42 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
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.
2010-06-18 Thomas Quinot <quinot@adacore.com>
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 3032267..5f7f26b 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -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
diff --git a/gcc/ada/exp_cg.adb b/gcc/ada/exp_cg.adb
index d207a3c..1ab11b8 100644
--- a/gcc/ada/exp_cg.adb
+++ b/gcc/ada/exp_cg.adb
@@ -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;
---------------------
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 229663b..3716f1a 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -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