Commit c88f5c49 by Javier Miranda Committed by Arnaud Charlet

[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
parent fd7de64c
2010-06-18 Javier Miranda <miranda@adacore.com> 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. * exp_cg.adb (Homonym_Suffix_Length): Minor code reorganization.
2010-06-18 Thomas Quinot <quinot@adacore.com> 2010-06-18 Thomas Quinot <quinot@adacore.com>
......
...@@ -596,6 +596,10 @@ package body Debug is ...@@ -596,6 +596,10 @@ package body Debug is
-- case of the gcc back end. Provided as a back up in case the new -- case of the gcc back end. Provided as a back up in case the new
-- scheme has problems. -- 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 -- d1 Error messages have node numbers where possible. Normally error
-- messages have only source locations. This option is useful when -- messages have only source locations. This option is useful when
-- debugging errors caused by expanded code, where the source location -- debugging errors caused by expanded code, where the source location
......
...@@ -29,9 +29,6 @@ with Einfo; use Einfo; ...@@ -29,9 +29,6 @@ with Einfo; use Einfo;
with Elists; use Elists; with Elists; use Elists;
with Exp_Disp; use Exp_Disp; with Exp_Disp; use Exp_Disp;
with Exp_Tss; use Exp_Tss; with Exp_Tss; use Exp_Tss;
-- with Interfaces.C;
-- with Interfaces.C_Streams;
-- Why are these commented out ???
with Lib; use Lib; with Lib; use Lib;
with Namet; use Namet; with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
...@@ -42,12 +39,31 @@ with Sem_Util; use Sem_Util; ...@@ -42,12 +39,31 @@ with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
with Sinput; use Sinput; with Sinput; use Sinput;
with Snames; use Snames; with Snames; use Snames;
with System; use System;
with Table; with Table;
with Uintp; use Uintp; with Uintp; use Uintp;
package body Exp_CG is 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 ( package Call_Graph_Nodes is new Table.Table (
Table_Component_Type => Node_Id, Table_Component_Type => Node_Id,
...@@ -56,7 +72,10 @@ package body Exp_CG is ...@@ -56,7 +72,10 @@ package body Exp_CG is
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Call_Graph_Nodes"); 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; function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
-- Determines if E is a predefined primitive operation. -- Determines if E is a predefined primitive operation.
...@@ -88,7 +107,12 @@ package body Exp_CG is ...@@ -88,7 +107,12 @@ package body Exp_CG is
N : Node_Id; N : Node_Id;
begin 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; return;
end if; end if;
...@@ -330,27 +354,16 @@ package body Exp_CG is ...@@ -330,27 +354,16 @@ package body Exp_CG is
-- Write_Output -- -- 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 procedure Write_Output (Str : String) is
Nul : constant Character := Character'First;
Line : String (Str'First .. Str'Last + 1);
Errno : Integer;
begin 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; end Write_Output;
--------------------- ---------------------
......
...@@ -135,6 +135,9 @@ static tree gnat_eh_personality (void); ...@@ -135,6 +135,9 @@ static tree gnat_eh_personality (void);
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; 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 /* 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 are incompatible with regular GDB versions, so we must make sure to only
produce them on explicit request. This is eventually reflected into the produce them on explicit request. This is eventually reflected into the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment