Commit 39f4e199 by Vincent Celier Committed by Arnaud Charlet

bcheck.adb, [...]: Move Name_Id, File_Name_Type and Unit_Name_Type from package…

bcheck.adb, [...]: Move Name_Id, File_Name_Type and Unit_Name_Type from package Types to package Namet.

2007-04-20  Vincent Celier  <celier@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* bcheck.adb, binde.adb, binderr.adb, binderr.ads, butil.adb, 
	butil.ads, erroutc.adb, erroutc.ads, errutil.adb, errutil.ads, 
	err_vars.ads, exp_tss.adb, exp_tss.ads, fmap.adb, fmap.ads, 
	fname.adb, fname.ads, fname-sf.adb, fname-uf.adb, fname-uf.ads, 
	lib-sort.adb, lib-util.adb, lib-util.ads, lib-xref.adb, makeutl.ads, 
	makeutl.adb, nmake.adt, osint.adb, osint.ads, osint-b.adb, 
	par-load.adb, prj-attr.adb, prj-dect.adb, prj-err.adb, prj-makr.adb, 
	prj-part.adb, prj-pp.adb, prj-proc.adb, prj-tree.adb, prj-tree.ads, 
	prj-util.adb, prj-util.ads, scans.adb, scans.ads, sem_ch2.adb, 
	sinput-c.adb, styleg-c.adb, tempdir.adb, tempdir.ads, uname.adb, 
	uname.ads, atree.h, atree.ads, atree.adb, ali-util.ads, ali-util.adb,
	ali.ads, ali.adb: 
	Move Name_Id, File_Name_Type and Unit_Name_Type from package Types to
	package Namet. Make File_Name_Type and Unit_Name_Type types derived from
	Mame_Id. Add new type Path_Name_Type, also derived from Name_Id.
	Use variables of types File_Name_Type and Unit_Name_Type in error
	messages.
	(Get_Name): Add parameter Ignore_Special, and set it reading file name
	(New_Copy): When debugging the compiler, call New_Node_Debugging_Output
	here.
	Define flags Flag217-Flag230 with associated subprograms
	(Flag_Word5): New record type.
	(Flag_Word5_Ptr): New access type.
	(To_Flag_Word5): New unchecked conversion.
	(To_Flag_Word5_Ptr): Likewise.
	(Flag216): New function.
	(Set_Flag216): New procedure.

From-SVN: r125377
parent 379ec904
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
with Debug; use Debug; with Debug; use Debug;
with Binderr; use Binderr; with Binderr; use Binderr;
with Lib; use Lib; with Lib; use Lib;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Output; use Output; with Output; use Output;
with Osint; use Osint; with Osint; use Osint;
...@@ -134,8 +133,8 @@ package body ALI.Util is ...@@ -134,8 +133,8 @@ package body ALI.Util is
-- Get_File_Checksum -- -- Get_File_Checksum --
----------------------- -----------------------
function Get_File_Checksum (Fname : Name_Id) return Word is function Get_File_Checksum (Fname : File_Name_Type) return Word is
Full_Name : Name_Id; Full_Name : File_Name_Type;
Source_Index : Source_File_Index; Source_Index : Source_File_Index;
begin begin
...@@ -255,9 +254,9 @@ package body ALI.Util is ...@@ -255,9 +254,9 @@ package body ALI.Util is
if Text = null then if Text = null then
if Generic_Separately_Compiled (Withs.Table (W).Sfile) then if Generic_Separately_Compiled (Withs.Table (W).Sfile) then
Error_Msg_Name_1 := Afile; Error_Msg_File_1 := Afile;
Error_Msg_Name_2 := Withs.Table (W).Sfile; Error_Msg_File_2 := Withs.Table (W).Sfile;
Error_Msg ("% not found, % must be compiled"); Error_Msg ("{ not found, { must be compiled");
Set_Name_Table_Info (Afile, Int (No_Unit_Id)); Set_Name_Table_Info (Afile, Int (No_Unit_Id));
return; return;
...@@ -278,13 +277,13 @@ package body ALI.Util is ...@@ -278,13 +277,13 @@ package body ALI.Util is
Free (Text); Free (Text);
if ALIs.Table (Idread).Compile_Errors then if ALIs.Table (Idread).Compile_Errors then
Error_Msg_Name_1 := Withs.Table (W).Sfile; Error_Msg_File_1 := Withs.Table (W).Sfile;
Error_Msg ("% had errors, must be fixed, and recompiled"); Error_Msg ("{ had errors, must be fixed, and recompiled");
Set_Name_Table_Info (Afile, Int (No_Unit_Id)); Set_Name_Table_Info (Afile, Int (No_Unit_Id));
elsif ALIs.Table (Idread).No_Object then elsif ALIs.Table (Idread).No_Object then
Error_Msg_Name_1 := Withs.Table (W).Sfile; Error_Msg_File_1 := Withs.Table (W).Sfile;
Error_Msg ("% must be recompiled"); Error_Msg ("{ must be recompiled");
Set_Name_Table_Info (Afile, Int (No_Unit_Id)); Set_Name_Table_Info (Afile, Int (No_Unit_Id));
end if; end if;
...@@ -335,7 +334,7 @@ package body ALI.Util is ...@@ -335,7 +334,7 @@ package body ALI.Util is
loop loop
F := Sdep.Table (D).Sfile; F := Sdep.Table (D).Sfile;
if F /= No_Name then if F /= No_File then
-- If this is the first time we are seeing this source file, -- If this is the first time we are seeing this source file,
-- then make a new entry in the source table. -- then make a new entry in the source table.
...@@ -376,8 +375,8 @@ package body ALI.Util is ...@@ -376,8 +375,8 @@ package body ALI.Util is
-- In All_Sources mode, flag error of file not found -- In All_Sources mode, flag error of file not found
if Opt.All_Sources then if Opt.All_Sources then
Error_Msg_Name_1 := F; Error_Msg_File_1 := F;
Error_Msg ("cannot locate %"); Error_Msg ("cannot locate {");
end if; end if;
end if; end if;
...@@ -468,8 +467,7 @@ package body ALI.Util is ...@@ -468,8 +467,7 @@ package body ALI.Util is
function Time_Stamp_Mismatch function Time_Stamp_Mismatch
(A : ALI_Id; (A : ALI_Id;
Read_Only : Boolean := False) Read_Only : Boolean := False) return File_Name_Type
return File_Name_Type
is is
Src : Source_Id; Src : Source_Id;
-- Source file Id for the current Sdep entry -- Source file Id for the current Sdep entry
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -109,15 +109,14 @@ package ALI.Util is ...@@ -109,15 +109,14 @@ package ALI.Util is
-- be read, scanned, and processed recursively. -- be read, scanned, and processed recursively.
procedure Set_Source_Table (A : ALI_Id); procedure Set_Source_Table (A : ALI_Id);
-- Build source table entry corresponding to the ALI file whose id is A. -- Build source table entry corresponding to the ALI file whose id is A
procedure Set_Source_Table; procedure Set_Source_Table;
-- Build the entire source table. -- Build the entire source table
function Time_Stamp_Mismatch function Time_Stamp_Mismatch
(A : ALI_Id; (A : ALI_Id;
Read_Only : Boolean := False) Read_Only : Boolean := False) return File_Name_Type;
return File_Name_Type;
-- Looks in the Source_Table and checks time stamp mismatches between -- Looks in the Source_Table and checks time stamp mismatches between
-- the sources there and the sources in the Sdep section of ali file whose -- the sources there and the sources in the Sdep section of ali file whose
-- id is A. If no time stamp mismatches are found No_File is returned. -- id is A. If no time stamp mismatches are found No_File is returned.
...@@ -139,7 +138,7 @@ package ALI.Util is ...@@ -139,7 +138,7 @@ package ALI.Util is
-- in a false negative, but that is never harmful, it just means -- in a false negative, but that is never harmful, it just means
-- that in unusual cases an unnecessary recompilation occurs. -- that in unusual cases an unnecessary recompilation occurs.
function Get_File_Checksum (Fname : Name_Id) return Word; function Get_File_Checksum (Fname : File_Name_Type) return Word;
-- Compute checksum for the given file. As far as possible, this circuit -- Compute checksum for the given file. As far as possible, this circuit
-- computes exactly the same value computed by the compiler, but it does -- computes exactly the same value computed by the compiler, but it does
-- not matter if it gets it wrong in marginal cases, since the only result -- not matter if it gets it wrong in marginal cases, since the only result
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
with Casing; use Casing; with Casing; use Casing;
with Gnatvsn; use Gnatvsn; with Gnatvsn; use Gnatvsn;
with Namet; use Namet;
with Rident; use Rident; with Rident; use Rident;
with Table; with Table;
with Types; use Types; with Types; use Types;
...@@ -90,7 +91,7 @@ package ALI is ...@@ -90,7 +91,7 @@ package ALI is
Afile : File_Name_Type; Afile : File_Name_Type;
-- Name of ALI file -- Name of ALI file
Ofile_Full_Name : Name_Id; Ofile_Full_Name : File_Name_Type;
-- Full name of object file corresponding to the ALI file -- Full name of object file corresponding to the ALI file
Sfile : File_Name_Type; Sfile : File_Name_Type;
...@@ -741,7 +742,7 @@ package ALI is ...@@ -741,7 +742,7 @@ package ALI is
File_Num : Sdep_Id; File_Num : Sdep_Id;
-- Dependency number for file (entry in Sdep.Table) -- Dependency number for file (entry in Sdep.Table)
File_Name : Name_Id; File_Name : File_Name_Type;
-- Name of file -- Name of file
First_Entity : Nat; First_Entity : Nat;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * C Header File *
* * * *
* Copyright (C) 1992-2006, Free Software Foundation, Inc. * * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -256,6 +256,46 @@ struct Flag_Word4 ...@@ -256,6 +256,46 @@ struct Flag_Word4
Boolean flag215 : 1; Boolean flag215 : 1;
}; };
/* Structure used for extra flags in fifth component overlaying Field12 */
struct Flag_Word5
{
Boolean flag216 : 1;
Boolean flag217 : 1;
Boolean flag218 : 1;
Boolean flag219 : 1;
Boolean flag220 : 1;
Boolean flag221 : 1;
Boolean flag222 : 1;
Boolean flag223 : 1;
Boolean flag224 : 1;
Boolean flag225 : 1;
Boolean flag226 : 1;
Boolean flag227 : 1;
Boolean flag228 : 1;
Boolean flag229 : 1;
Boolean flag230 : 1;
Boolean flag231 : 1;
Boolean flag232 : 1;
Boolean flag233 : 1;
Boolean flag234 : 1;
Boolean flag235 : 1;
Boolean flag236 : 1;
Boolean flag237 : 1;
Boolean flag238 : 1;
Boolean flag239 : 1;
Boolean flag240 : 1;
Boolean flag241 : 1;
Boolean flag242 : 1;
Boolean flag243 : 1;
Boolean flag244 : 1;
Boolean flag245 : 1;
Boolean flag246 : 1;
Boolean flag247 : 1;
};
struct Non_Extended struct Non_Extended
{ {
Source_Ptr sloc; Source_Ptr sloc;
...@@ -287,6 +327,7 @@ struct Extended ...@@ -287,6 +327,7 @@ struct Extended
Int field12; Int field12;
struct Flag_Word fw; struct Flag_Word fw;
struct Flag_Word2 fw2; struct Flag_Word2 fw2;
struct Flag_Word5 fw5;
} U; } U;
}; };
...@@ -686,3 +727,18 @@ extern Node_Id Current_Error_Node; ...@@ -686,3 +727,18 @@ extern Node_Id Current_Error_Node;
#define Flag213(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag213) #define Flag213(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag213)
#define Flag214(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag214) #define Flag214(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag214)
#define Flag215(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag215) #define Flag215(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.X.fw4.flag215)
#define Flag216(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag216)
#define Flag217(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag217)
#define Flag218(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag218)
#define Flag219(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag219)
#define Flag220(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag220)
#define Flag221(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag221)
#define Flag222(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag222)
#define Flag223(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag223)
#define Flag224(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag224)
#define Flag225(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag225)
#define Flag226(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag226)
#define Flag227(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag227)
#define Flag228(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag228)
#define Flag229(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag229)
#define Flag230(N) (Nodes_Ptr[(N) - First_Node_Id + 4].V.EX.U.fw5.flag230)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -266,7 +266,7 @@ package body Binde is ...@@ -266,7 +266,7 @@ package body Binde is
procedure Elab_Error_Msg (S : Successor_Id); procedure Elab_Error_Msg (S : Successor_Id);
-- Given a successor link, outputs an error message of the form -- Given a successor link, outputs an error message of the form
-- "& must be elaborated before & ..." where ... is the reason. -- "$ must be elaborated before $ ..." where ... is the reason.
procedure Gather_Dependencies; procedure Gather_Dependencies;
-- Compute dependencies, building the Succ and UNR tables -- Compute dependencies, building the Succ and UNR tables
...@@ -911,17 +911,17 @@ package body Binde is ...@@ -911,17 +911,17 @@ package body Binde is
-- Here we want to generate output -- Here we want to generate output
Error_Msg_Name_1 := Units.Table (SL.Before).Uname; Error_Msg_Unit_1 := Units.Table (SL.Before).Uname;
if SL.Elab_Body then if SL.Elab_Body then
Error_Msg_Name_2 := Units.Table (Corresponding_Body (SL.After)).Uname; Error_Msg_Unit_2 := Units.Table (Corresponding_Body (SL.After)).Uname;
else else
Error_Msg_Name_2 := Units.Table (SL.After).Uname; Error_Msg_Unit_2 := Units.Table (SL.After).Uname;
end if; end if;
Error_Msg_Output (" & must be elaborated before &", Info => True); Error_Msg_Output (" $ must be elaborated before $", Info => True);
Error_Msg_Name_1 := Units.Table (SL.Reason_Unit).Uname; Error_Msg_Unit_1 := Units.Table (SL.Reason_Unit).Uname;
case SL.Reason is case SL.Reason is
when Withed => when Withed =>
...@@ -931,30 +931,30 @@ package body Binde is ...@@ -931,30 +931,30 @@ package body Binde is
when Elab => when Elab =>
Error_Msg_Output Error_Msg_Output
(" reason: pragma Elaborate in unit &", (" reason: pragma Elaborate in unit $",
Info => True); Info => True);
when Elab_All => when Elab_All =>
Error_Msg_Output Error_Msg_Output
(" reason: pragma Elaborate_All in unit &", (" reason: pragma Elaborate_All in unit $",
Info => True); Info => True);
when Elab_All_Desirable => when Elab_All_Desirable =>
Error_Msg_Output Error_Msg_Output
(" reason: implicit Elaborate_All in unit &", (" reason: implicit Elaborate_All in unit $",
Info => True); Info => True);
Error_Msg_Output Error_Msg_Output
(" recompile & with -gnatwl for full details", (" recompile $ with -gnatwl for full details",
Info => True); Info => True);
when Elab_Desirable => when Elab_Desirable =>
Error_Msg_Output Error_Msg_Output
(" reason: implicit Elaborate in unit &", (" reason: implicit Elaborate in unit $",
Info => True); Info => True);
Error_Msg_Output Error_Msg_Output
(" recompile & with -gnatwl for full details", (" recompile $ with -gnatwl for full details",
Info => True); Info => True);
when Spec_First => when Spec_First =>
...@@ -966,19 +966,21 @@ package body Binde is ...@@ -966,19 +966,21 @@ package body Binde is
Write_Elab_All_Chain (S); Write_Elab_All_Chain (S);
if SL.Elab_Body then if SL.Elab_Body then
Error_Msg_Name_1 := Units.Table (SL.Before).Uname; Error_Msg_Unit_1 := Units.Table (SL.Before).Uname;
Error_Msg_Name_2 := Units.Table (SL.After).Uname; Error_Msg_Unit_2 := Units.Table (SL.After).Uname;
Error_Msg_Output Error_Msg_Output
(" & must therefore be elaborated before &", (" $ must therefore be elaborated before $",
True); True);
Error_Msg_Name_1 := Units.Table (SL.After).Uname; Error_Msg_Unit_1 := Units.Table (SL.After).Uname;
Error_Msg_Output Error_Msg_Output
(" (because & has a pragma Elaborate_Body)", (" (because $ has a pragma Elaborate_Body)",
True); True);
end if; end if;
Write_Eol; if not Zero_Formatting then
Write_Eol;
end if;
end Elab_Error_Msg; end Elab_Error_Msg;
--------------------- ---------------------
...@@ -1155,9 +1157,9 @@ package body Binde is ...@@ -1155,9 +1157,9 @@ package body Binde is
-- obsolete unit with's a previous (now disappeared) spec. -- obsolete unit with's a previous (now disappeared) spec.
if Get_Name_Table_Info (Withs.Table (W).Uname) = 0 then if Get_Name_Table_Info (Withs.Table (W).Uname) = 0 then
Error_Msg_Name_1 := Units.Table (U).Sfile; Error_Msg_File_1 := Units.Table (U).Sfile;
Error_Msg_Name_2 := Withs.Table (W).Uname; Error_Msg_Unit_1 := Withs.Table (W).Uname;
Error_Msg ("% depends on & which no longer exists"); Error_Msg ("{ depends on $ which no longer exists");
goto Next_With; goto Next_With;
end if; end if;
...@@ -1403,11 +1405,12 @@ package body Binde is ...@@ -1403,11 +1405,12 @@ package body Binde is
procedure Write_Dependencies is procedure Write_Dependencies is
begin begin
Write_Eol; if not Zero_Formatting then
Write_Str Write_Eol;
(" ELABORATION ORDER DEPENDENCIES"); Write_Str (" ELABORATION ORDER DEPENDENCIES");
Write_Eol; Write_Eol;
Write_Eol; Write_Eol;
end if;
Info_Prefix_Suppress := True; Info_Prefix_Suppress := True;
...@@ -1416,7 +1419,10 @@ package body Binde is ...@@ -1416,7 +1419,10 @@ package body Binde is
end loop; end loop;
Info_Prefix_Suppress := False; Info_Prefix_Suppress := False;
Write_Eol;
if not Zero_Formatting then
Write_Eol;
end if;
end Write_Dependencies; end Write_Dependencies;
-------------------------- --------------------------
...@@ -1437,8 +1443,8 @@ package body Binde is ...@@ -1437,8 +1443,8 @@ package body Binde is
L := ST.Elab_All_Link; L := ST.Elab_All_Link;
while L /= No_Elab_All_Link loop while L /= No_Elab_All_Link loop
Nam := Elab_All_Entries.Table (L).Needed_By; Nam := Elab_All_Entries.Table (L).Needed_By;
Error_Msg_Name_1 := Nam; Error_Msg_Unit_1 := Nam;
Error_Msg_Output (" &", Info => True); Error_Msg_Output (" $", Info => True);
Get_Name_String (Nam); Get_Name_String (Nam);
...@@ -1473,8 +1479,8 @@ package body Binde is ...@@ -1473,8 +1479,8 @@ package body Binde is
L := Elab_All_Entries.Table (L).Next_Elab; L := Elab_All_Entries.Table (L).Next_Elab;
end loop; end loop;
Error_Msg_Name_1 := After; Error_Msg_Unit_1 := After;
Error_Msg_Output (" &", Info => True); Error_Msg_Output (" $", Info => True);
end if; end if;
end Write_Elab_All_Chain; end Write_Elab_All_Chain;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,10 +24,9 @@ ...@@ -24,10 +24,9 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Butil; use Butil; with Butil; use Butil;
with Namet; use Namet; with Opt; use Opt;
with Opt; use Opt; with Output; use Output;
with Output; use Output;
package body Binderr is package body Binderr is
...@@ -95,8 +94,10 @@ package body Binderr is ...@@ -95,8 +94,10 @@ package body Binderr is
---------------------- ----------------------
procedure Error_Msg_Output (Msg : String; Info : Boolean) is procedure Error_Msg_Output (Msg : String; Info : Boolean) is
Use_Second_Name : Boolean := False; Use_Second_File : Boolean := False;
Use_Second_Unit : Boolean := False;
Use_Second_Nat : Boolean := False; Use_Second_Nat : Boolean := False;
Warning : Boolean := False;
begin begin
if Warnings_Detected + Errors_Detected > Maximum_Errors then if Warnings_Detected + Errors_Detected > Maximum_Errors then
...@@ -105,7 +106,16 @@ package body Binderr is ...@@ -105,7 +106,16 @@ package body Binderr is
return; return;
end if; end if;
if Msg (Msg'First) = '?' then -- First, check for warnings
for J in Msg'Range loop
if Msg (J) = '?' then
Warning := True;
exit;
end if;
end loop;
if Warning then
Write_Str ("warning: "); Write_Str ("warning: ");
elsif Info then elsif Info then
if not Info_Prefix_Suppress then if not Info_Prefix_Suppress then
...@@ -117,26 +127,31 @@ package body Binderr is ...@@ -117,26 +127,31 @@ package body Binderr is
for J in Msg'Range loop for J in Msg'Range loop
if Msg (J) = '%' then if Msg (J) = '%' then
Get_Name_String (Error_Msg_Name_1);
Write_Char ('"');
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Char ('"');
if Use_Second_Name then elsif Msg (J) = '{' then
Get_Name_String (Error_Msg_Name_2); if Use_Second_File then
Get_Name_String (Error_Msg_File_2);
else else
Use_Second_Name := True; Use_Second_File := True;
Get_Name_String (Error_Msg_Name_1); Get_Name_String (Error_Msg_File_1);
end if; end if;
Write_Char ('"'); Write_Char ('"');
Write_Str (Name_Buffer (1 .. Name_Len)); Write_Str (Name_Buffer (1 .. Name_Len));
Write_Char ('"'); Write_Char ('"');
elsif Msg (J) = '&' then elsif Msg (J) = '$' then
Write_Char ('"'); Write_Char ('"');
if Use_Second_Name then if Use_Second_Unit then
Write_Unit_Name (Error_Msg_Name_2); Write_Unit_Name (Error_Msg_Unit_2);
else else
Use_Second_Name := True; Use_Second_Unit := True;
Write_Unit_Name (Error_Msg_Name_1); Write_Unit_Name (Error_Msg_Unit_1);
end if; end if;
Write_Char ('"'); Write_Char ('"');
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
-- This package contains the routines to output error messages for the binder -- This package contains the routines to output error messages for the binder
-- and also the routines for handling fatal error conditions in the binder. -- and also the routines for handling fatal error conditions in the binder.
with Namet; use Namet;
with Types; use Types; with Types; use Types;
package Binderr is package Binderr is
...@@ -51,19 +52,19 @@ package Binderr is ...@@ -51,19 +52,19 @@ package Binderr is
-- appear which cause the error message circuit to modify the given -- appear which cause the error message circuit to modify the given
-- string as follows: -- string as follows:
-- Insertion character % (Percent: insert file name from Names table) -- Insertion character { (Left brace: insert file name from Names table)
-- The character % is replaced by the text for the file name specified -- The character { is replaced by the text for the file name specified
-- by the Name_Id value stored in Error_Msg_Name_1. The name is always -- by the File_Name_Type value stored in Error_Msg_File_1. The name is
-- enclosed in quotes. A second % may appear in a single message in -- always enclosed in quotes. A second % may appear in a single message
-- which case it is similarly replaced by the name which is specified -- in which case it is similarly replaced by the name which is
-- by the Name_Id value stored in Error_Msg_Name_2. -- specified by the File_Name_Type value stored in Error_Msg_File_2.
-- Insertion character & (Ampersand: insert unit name from Names table) -- Insertion character $ (Dollar: insert unit name from Names table)
-- The character & is replaced by the text for the unit name specified -- The character & is replaced by the text for the unit name specified
-- by the Name_Id value stored in Error_Msg_Name_1. The name is always -- by the Name_Id value stored in Error_Msg_Unit_1. The name is always
-- enclosed in quotes. A second & may appear in a single message in -- enclosed in quotes. A second & may appear in a single message in
-- which case it is similarly replaced by the name which is specified -- which case it is similarly replaced by the name which is specified
-- by the Name_Id value stored in Error_Msg_Name_2. -- by the Name_Id value stored in Error_Msg_Unit_2.
-- Insertion character # (Pound: insert non-negative number in decimal) -- Insertion character # (Pound: insert non-negative number in decimal)
-- The character # is replaced by the contents of Error_Msg_Nat_1 -- The character # is replaced by the contents of Error_Msg_Nat_1
...@@ -83,11 +84,18 @@ package Binderr is ...@@ -83,11 +84,18 @@ package Binderr is
-- passed to the error message routine for insertion sequences described -- passed to the error message routine for insertion sequences described
-- above. The reason these are passed globally is that the insertion -- above. The reason these are passed globally is that the insertion
-- mechanism is essentially an untyped one in which the appropriate -- mechanism is essentially an untyped one in which the appropriate
-- variables are set dependingon the specific insertion characters used. -- variables are set depending on the specific insertion characters used.
Error_Msg_Name_1 : Name_Id; Error_Msg_Name_1 : Name_Id;
Error_Msg_Name_2 : Name_Id; -- Name_Id value for % insertion characters in message
-- Name_Id values for % insertion characters in message
Error_Msg_File_1 : File_Name_Type;
Error_Msg_File_2 : File_Name_Type;
-- Name_Id values for { insertion characters in message
Error_Msg_Unit_1 : Unit_Name_Type;
Error_Msg_Unit_2 : Unit_Name_Type;
-- Name_Id values for $ insertion characters in message
Error_Msg_Nat_1 : Nat; Error_Msg_Nat_1 : Nat;
Error_Msg_Nat_2 : Nat; Error_Msg_Nat_2 : Nat;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Output; use Output; with Output; use Output;
with Targparm; use Targparm; with Targparm; use Targparm;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Types; use Types; with Namet; use Namet;
package Butil is package Butil is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
-- This package contains variables common to error reporting packages -- This package contains variables common to error reporting packages
-- including Errout and Prj.Err. -- including Errout and Prj.Err.
with Namet; use Namet;
with Types; use Types; with Types; use Types;
with Uintp; use Uintp; with Uintp; use Uintp;
...@@ -120,9 +121,14 @@ package Err_Vars is ...@@ -120,9 +121,14 @@ package Err_Vars is
Error_Msg_Name_3 : Name_Id; Error_Msg_Name_3 : Name_Id;
-- Name_Id values for % insertion characters in message -- Name_Id values for % insertion characters in message
Error_Msg_Unit_1 : Name_Id; Error_Msg_File_1 : File_Name_Type;
Error_Msg_Unit_2 : Name_Id; Error_Msg_File_2 : File_Name_Type;
-- Name_Id values for $ insertion characters in message Error_Msg_File_3 : File_Name_Type;
-- File_Name_Type values for { insertion characters in message
Error_Msg_Unit_1 : Unit_Name_Type;
Error_Msg_Unit_2 : Unit_Name_Type;
-- Unit_Name_Type values for $ insertion characters in message
Error_Msg_Node_1 : Node_Id; Error_Msg_Node_1 : Node_Id;
Error_Msg_Node_2 : Node_Id; Error_Msg_Node_2 : Node_Id;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -673,32 +673,32 @@ package body Erroutc is ...@@ -673,32 +673,32 @@ package body Erroutc is
procedure Set_Msg_Insertion_File_Name is procedure Set_Msg_Insertion_File_Name is
begin begin
if Error_Msg_Name_1 = No_Name then if Error_Msg_File_1 = No_File then
null; null;
elsif Error_Msg_Name_1 = Error_Name then elsif Error_Msg_File_1 = Error_File_Name then
Set_Msg_Blank; Set_Msg_Blank;
Set_Msg_Str ("<error>"); Set_Msg_Str ("<error>");
else else
Set_Msg_Blank; Set_Msg_Blank;
Get_Name_String (Error_Msg_Name_1); Get_Name_String (Error_Msg_File_1);
Set_Msg_Quote; Set_Msg_Quote;
Set_Msg_Name_Buffer; Set_Msg_Name_Buffer;
Set_Msg_Quote; Set_Msg_Quote;
end if; end if;
-- The following assignments ensure that the second and third percent -- The following assignments ensure that the second and third {
-- insertion characters will correspond to the Error_Msg_Name_2 and -- insertion characters will correspond to the Error_Msg_File_2 and
-- Error_Msg_Name_3 as required. We suppress possible validity checks in -- Error_Msg_File_3 values and We suppress possible validity checks in
-- case operating in -gnatVa mode, and Error_Msg_Name_2/3 is not needed -- case operating in -gnatVa mode, and Error_Msg_File_2 or
-- and has not been set. -- Error_Msg_File_3 is not needed and has not been set.
declare declare
pragma Suppress (Range_Check); pragma Suppress (Range_Check);
begin begin
Error_Msg_Name_1 := Error_Msg_Name_2; Error_Msg_File_1 := Error_Msg_File_2;
Error_Msg_Name_2 := Error_Msg_Name_3; Error_Msg_File_2 := Error_Msg_File_3;
end; end;
end Set_Msg_Insertion_File_Name; end Set_Msg_Insertion_File_Name;
...@@ -857,6 +857,41 @@ package body Erroutc is ...@@ -857,6 +857,41 @@ package body Erroutc is
end; end;
end Set_Msg_Insertion_Name; end Set_Msg_Insertion_Name;
------------------------------------
-- Set_Msg_Insertion_Name_Literal --
------------------------------------
procedure Set_Msg_Insertion_Name_Literal is
begin
if Error_Msg_Name_1 = No_Name then
null;
elsif Error_Msg_Name_1 = Error_Name then
Set_Msg_Blank;
Set_Msg_Str ("<error>");
else
Set_Msg_Blank;
Get_Name_String (Error_Msg_Name_1);
Set_Msg_Quote;
Set_Msg_Name_Buffer;
Set_Msg_Quote;
end if;
-- The following assignments ensure that the second and third % or %%
-- insertion characters will correspond to the Error_Msg_Name_2 and
-- Error_Msg_Name_3 values and We suppress possible validity checks in
-- case operating in -gnatVa mode, and Error_Msg_Name_2 or
-- Error_Msg_Name_3 is not needed and has not been set.
declare
pragma Suppress (Range_Check);
begin
Error_Msg_Name_1 := Error_Msg_Name_2;
Error_Msg_Name_2 := Error_Msg_Name_3;
end;
end Set_Msg_Insertion_Name_Literal;
------------------------------------- -------------------------------------
-- Set_Msg_Insertion_Reserved_Name -- -- Set_Msg_Insertion_Reserved_Name --
------------------------------------- -------------------------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -381,6 +381,8 @@ package Erroutc is ...@@ -381,6 +381,8 @@ package Erroutc is
-- location to be referenced, and Flag is the location at which the -- location to be referenced, and Flag is the location at which the
-- flag is posted (used to determine whether to add "in file xxx") -- flag is posted (used to determine whether to add "in file xxx")
procedure Set_Msg_Insertion_Name_Literal;
procedure Set_Msg_Insertion_Name; procedure Set_Msg_Insertion_Name;
-- Handle name insertion (% insertion character) -- Handle name insertion (% insertion character)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1991-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1991-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -681,7 +681,12 @@ package body Errutil is ...@@ -681,7 +681,12 @@ package body Errutil is
-- Check for insertion character -- Check for insertion character
if C = '%' then if C = '%' then
Set_Msg_Insertion_Name; if P <= Text'Last and then Text (P) = '%' then
P := P + 1;
Set_Msg_Insertion_Name_Literal;
else
Set_Msg_Insertion_Name;
end if;
elsif C = '$' then elsif C = '$' then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2002-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -49,101 +49,7 @@ package Errutil is ...@@ -49,101 +49,7 @@ package Errutil is
-- and the special characters space, comma, period, colon and semicolon, -- and the special characters space, comma, period, colon and semicolon,
-- apostrophe and parentheses. Special insertion characters can also -- apostrophe and parentheses. Special insertion characters can also
-- appear which cause the error message circuit to modify the given -- appear which cause the error message circuit to modify the given
-- string as follows: -- string. For a full list of these, see the spec of errout.
-- Ignored insertion characters: the following characters, used as
-- insertion characters by Errout are ignored: '$', '&', and '}'.
-- If present in an error message, they are not output and are not
-- replaced by any text.
-- Insertion character % (Percent: insert name from Names table)
-- The character % is replaced by the text for the name specified by
-- the Name_Id value stored in Error_Msg_Name_1. A blank precedes
-- the name if it is preceded by a non-blank character other than a
-- left parenthesis. The name is enclosed in quotes unless manual
-- quotation mode is set. If the Name_Id is set to No_Name, then
-- no insertion occurs; if the Name_Id is set to Error_Name, then
-- the string <error> is inserted. A second and third % may appear
-- in a single message, similarly replaced by the names which are
-- specified by the Name_Id values stored in Error_Msg_Name_2 and
-- Error_Msg_Name_3. The names are decoded and cased according to
-- the current identifier casing mode.
-- Insertion character { (Left brace: insert literally from names table)
-- The character { is treated similarly to %, except that the
-- name is output literally as stored in the names table without
-- adjusting the casing. This can be used for file names and in
-- other situations where the name string is to be output unchanged.
-- Insertion character * (Asterisk, insert reserved word name)
-- The insertion character * is treated exactly like % except that
-- the resulting name is cased according to the default conventions
-- for reserved words (see package Scans).
-- Insertion character # (Pound: insert line number reference)
-- The character # is replaced by the string indicating the source
-- position stored in Error_Msg_Sloc. There are two cases:
--
-- for locations in current file: at line nnn:ccc
-- for locations in other files: at filename:nnn:ccc
--
-- By convention, the # insertion character is only used at the end
-- of an error message, so the above strings only appear as the last
-- characters of an error message.
-- Insertion character @ (At: insert column number reference)
-- The character @ is replaced by null if the RM_Column_Check mode is
-- off (False). If the switch is on (True), then @ is replaced by the
-- text string " in column nnn" where nnn is the decimal representation
-- of the column number stored in Error_Msg_Col plus one (the plus one
-- is because the number is stored 0-origin and displayed 1-origin).
-- Insertion character ^ (Carret: insert integer value)
-- The character ^ is replaced by the decimal conversion of the Uint
-- value stored in Error_Msg_Uint_1, with a possible leading minus.
-- A second ^ may occur in the message, in which case it is replaced
-- by the decimal conversion of the Uint value in Error_Msg_Uint_2.
-- Insertion character ! (Exclamation: unconditional message)
-- The character ! appearing as the last character of a message makes
-- the message unconditional which means that it is output even if it
-- would normally be suppressed.
-- Insertion character ? (Question: warning message)
-- The character ? appearing anywhere in a message makes the message
-- a warning instead of a normal error message, and the text of the
-- message will be preceded by "Warning:" instead of "Error:" The
-- handling of warnings if further controlled by the Warning_Mode
-- option (-w switch), see package Opt for further details, and
-- also by the current setting from pragma Warnings. This pragma
-- applies only to warnings issued from the semantic phase (not
-- the parser), but currently all relevant warnings are posted
-- by the semantic phase anyway. Messages starting with (style)
-- are also treated as warning messages.
-- Insertion character A-Z (Upper case letter: Ada reserved word)
-- If two or more upper case letters appear in the message, they are
-- taken as an Ada reserved word, and are converted to the default
-- case for reserved words (see Scans package spec). Surrounding
-- quotes are added unless manual quotation mode is currently set.
-- Insertion character ` (Backquote: set manual quotation mode)
-- The backquote character always appears in pairs. Each backquote
-- of the pair is replaced by a double quote character. In addition,
-- Any reserved keywords, or name insertions between these backquotes
-- are not surrounded by the usual automatic double quotes. See the
-- section below on manual quotation mode for further details.
-- Insertion character ' (Quote: literal character)
-- Precedes a character which is placed literally into the message.
-- Used to insert characters into messages that are one of the
-- insertion characters defined here.
-- Insertion character \ (Backslash: continuation message)
-- Indicates that the message is a continuation of a message
-- previously posted. This is used to ensure that such groups
-- of messages are treated as a unit. The \ character must be
-- the first character of the message text.
----------------------------------------------------- -----------------------------------------------------
-- Format of Messages and Manual Quotation Control -- -- Format of Messages and Manual Quotation Control --
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -29,7 +29,6 @@ with Einfo; use Einfo; ...@@ -29,7 +29,6 @@ with Einfo; use Einfo;
with Elists; use Elists; with Elists; use Elists;
with Exp_Util; use Exp_Util; with Exp_Util; use Exp_Util;
with Lib; use Lib; with Lib; use Lib;
with Namet; use Namet;
with Sem_Util; use Sem_Util; with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
-- Type Support Subprogram (TSS) handling -- Type Support Subprogram (TSS) handling
with Namet; use Namet;
with Types; use Types; with Types; use Types;
package Exp_Tss is package Exp_Tss is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib; with Opt; use Opt;
with Namet; use Namet; with Osint; use Osint;
with Opt; use Opt; with Output; use Output;
with Osint; use Osint;
with Output; use Output;
with Table; with Table;
with Types; use Types;
with System.OS_Lib; use System.OS_Lib;
with Unchecked_Conversion; with Unchecked_Conversion;
...@@ -91,6 +92,9 @@ package body Fmap is ...@@ -91,6 +92,9 @@ package body Fmap is
-- Hash table to map unit names to file names. Used in conjunction with -- Hash table to map unit names to file names. Used in conjunction with
-- table File_Mapping above. -- table File_Mapping above.
function Hash (F : File_Name_Type) return Header_Num;
-- Function used to compute hash of file name
package File_Hash_Table is new GNAT.HTable.Simple_HTable ( package File_Hash_Table is new GNAT.HTable.Simple_HTable (
Header_Num => Header_Num, Header_Num => Header_Num,
Element => Int, Element => Int,
...@@ -115,7 +119,7 @@ package body Fmap is ...@@ -115,7 +119,7 @@ package body Fmap is
-- Add_Forbidden_File_Name -- -- Add_Forbidden_File_Name --
----------------------------- -----------------------------
procedure Add_Forbidden_File_Name (Name : Name_Id) is procedure Add_Forbidden_File_Name (Name : File_Name_Type) is
begin begin
Forbidden_Names.Set (Name, True); Forbidden_Names.Set (Name, True);
end Add_Forbidden_File_Name; end Add_Forbidden_File_Name;
...@@ -144,6 +148,11 @@ package body Fmap is ...@@ -144,6 +148,11 @@ package body Fmap is
-- Hash -- -- Hash --
---------- ----------
function Hash (F : File_Name_Type) return Header_Num is
begin
return Header_Num (Int (F) rem Header_Num'Range_Length);
end Hash;
function Hash (F : Unit_Name_Type) return Header_Num is function Hash (F : Unit_Name_Type) return Header_Num is
begin begin
return Header_Num (Int (F) rem Header_Num'Range_Length); return Header_Num (Int (F) rem Header_Num'Range_Length);
...@@ -163,16 +172,20 @@ package body Fmap is ...@@ -163,16 +172,20 @@ package body Fmap is
Last : Natural := 0; Last : Natural := 0;
Uname : Unit_Name_Type; Uname : Unit_Name_Type;
Fname : Name_Id; Fname : File_Name_Type;
Pname : Name_Id; Pname : File_Name_Type;
The_Mapping : Mapping;
procedure Empty_Tables (Warning : Boolean := True); procedure Empty_Tables;
-- Remove all entries in case of incorrect mapping file -- Remove all entries in case of incorrect mapping file
function Find_Name return Name_Id; function Find_File_Name return File_Name_Type;
-- Return Error_Name for "/", otherwise call Name_Find -- Return Error_File_Name for "/", otherwise call Name_Find
-- What is this about, explanation required ???
function Find_Unit_Name return Unit_Name_Type;
-- Return Error_Unit_Name for "/", otherwise call Name_Find
-- Even more mysterious??? function appeared when Find_Name was split
-- for the two types, but this routine is definitely called!
procedure Get_Line; procedure Get_Line;
-- Get a line from the mapping file -- Get a line from the mapping file
...@@ -185,14 +198,8 @@ package body Fmap is ...@@ -185,14 +198,8 @@ package body Fmap is
-- Empty_Tables -- -- Empty_Tables --
------------------ ------------------
procedure Empty_Tables (Warning : Boolean := True) is procedure Empty_Tables is
begin begin
if Warning then
Write_Str ("mapping file """);
Write_Str (File_Name);
Write_Line (""" is not taken into account");
end if;
Unit_Hash_Table.Reset; Unit_Hash_Table.Reset;
File_Hash_Table.Reset; File_Hash_Table.Reset;
Path_Mapping.Set_Last (0); Path_Mapping.Set_Last (0);
...@@ -200,19 +207,30 @@ package body Fmap is ...@@ -200,19 +207,30 @@ package body Fmap is
Last_In_Table := 0; Last_In_Table := 0;
end Empty_Tables; end Empty_Tables;
--------------- --------------------
-- Find_Name -- -- Find_File_Name --
--------------- --------------------
-- Why is only / illegal, why not \ on windows ???
function Find_Name return Name_Id is function Find_File_Name return File_Name_Type is
begin begin
if Name_Buffer (1 .. Name_Len) = "/" then if Name_Buffer (1 .. Name_Len) = "/" then
return Error_Name; return Error_File_Name;
else else
return Name_Find; return Name_Find;
end if; end if;
end Find_Name; end Find_File_Name;
--------------------
-- Find_Unit_Name --
--------------------
function Find_Unit_Name return Unit_Name_Type is
begin
return Unit_Name_Type (Find_File_Name);
-- very odd ???
end Find_Unit_Name;
-------------- --------------
-- Get_Line -- -- Get_Line --
...@@ -261,10 +279,10 @@ package body Fmap is ...@@ -261,10 +279,10 @@ package body Fmap is
Write_Line (""" is truncated"); Write_Line (""" is truncated");
end Report_Truncated; end Report_Truncated;
-- Start of procedure Initialize -- Start of processing for Initialize
begin begin
Empty_Tables (Warning => False); Empty_Tables;
Name_Len := File_Name'Length; Name_Len := File_Name'Length;
Name_Buffer (1 .. Name_Len) := File_Name; Name_Buffer (1 .. Name_Len) := File_Name;
Read_Source_File (Name_Enter, 0, Hi, Src, Config); Read_Source_File (Name_Enter, 0, Hi, Src, Config);
...@@ -299,7 +317,7 @@ package body Fmap is ...@@ -299,7 +317,7 @@ package body Fmap is
Name_Len := Last - First + 1; Name_Len := Last - First + 1;
Name_Buffer (1 .. Name_Len) := SP (First .. Last); Name_Buffer (1 .. Name_Len) := SP (First .. Last);
Uname := Find_Name; Uname := Find_Unit_Name;
-- Get the file name -- Get the file name
...@@ -316,7 +334,7 @@ package body Fmap is ...@@ -316,7 +334,7 @@ package body Fmap is
Name_Len := Last - First + 1; Name_Len := Last - First + 1;
Name_Buffer (1 .. Name_Len) := SP (First .. Last); Name_Buffer (1 .. Name_Len) := SP (First .. Last);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Fname := Find_Name; Fname := Find_File_Name;
-- Get the path name -- Get the path name
...@@ -332,32 +350,16 @@ package body Fmap is ...@@ -332,32 +350,16 @@ package body Fmap is
Name_Len := Last - First + 1; Name_Len := Last - First + 1;
Name_Buffer (1 .. Name_Len) := SP (First .. Last); Name_Buffer (1 .. Name_Len) := SP (First .. Last);
Pname := Find_Name; Pname := Find_File_Name;
-- Check for duplicate entries -- Check for duplicate entries
if Unit_Hash_Table.Get (Uname) /= No_Entry then if Unit_Hash_Table.Get (Uname) /= No_Entry then
Write_Str ("warning: duplicate entry """);
Write_Str (Get_Name_String (Uname));
Write_Str (""" in mapping file """);
Write_Str (File_Name);
Write_Line ("""");
The_Mapping := File_Mapping.Table (Unit_Hash_Table.Get (Uname));
Write_Line (Get_Name_String (The_Mapping.Uname));
Write_Line (Get_Name_String (The_Mapping.Fname));
Empty_Tables; Empty_Tables;
return; return;
end if; end if;
if File_Hash_Table.Get (Fname) /= No_Entry then if File_Hash_Table.Get (Fname) /= No_Entry then
Write_Str ("warning: duplicate entry """);
Write_Str (Get_Name_String (Fname));
Write_Str (""" in mapping file """);
Write_Str (File_Name);
Write_Line ("""");
The_Mapping := Path_Mapping.Table (File_Hash_Table.Get (Fname));
Write_Line (Get_Name_String (The_Mapping.Uname));
Write_Line (Get_Name_String (The_Mapping.Fname));
Empty_Tables; Empty_Tables;
return; return;
end if; end if;
...@@ -371,7 +373,6 @@ package body Fmap is ...@@ -371,7 +373,6 @@ package body Fmap is
-- Record the length of the two mapping tables -- Record the length of the two mapping tables
Last_In_Table := File_Mapping.Last; Last_In_Table := File_Mapping.Last;
end Initialize; end Initialize;
---------------------- ----------------------
...@@ -398,7 +399,7 @@ package body Fmap is ...@@ -398,7 +399,7 @@ package body Fmap is
begin begin
if Forbidden_Names.Get (File) then if Forbidden_Names.Get (File) then
return Error_Name; return Error_File_Name;
end if; end if;
Index := File_Hash_Table.Get (File); Index := File_Hash_Table.Get (File);
...@@ -414,7 +415,7 @@ package body Fmap is ...@@ -414,7 +415,7 @@ package body Fmap is
-- Remove_Forbidden_File_Name -- -- Remove_Forbidden_File_Name --
-------------------------------- --------------------------------
procedure Remove_Forbidden_File_Name (Name : Name_Id) is procedure Remove_Forbidden_File_Name (Name : File_Name_Type) is
begin begin
Forbidden_Names.Set (Name, False); Forbidden_Names.Set (Name, False);
end Remove_Forbidden_File_Name; end Remove_Forbidden_File_Name;
...@@ -506,9 +507,9 @@ package body Fmap is ...@@ -506,9 +507,9 @@ package body Fmap is
end if; end if;
for Unit in Last_In_Table + 1 .. File_Mapping.Last loop for Unit in Last_In_Table + 1 .. File_Mapping.Last loop
Put_Line (File_Mapping.Table (Unit).Uname); Put_Line (Name_Id (File_Mapping.Table (Unit).Uname));
Put_Line (File_Mapping.Table (Unit).Fname); Put_Line (Name_Id (File_Mapping.Table (Unit).Fname));
Put_Line (Path_Mapping.Table (Unit).Fname); Put_Line (Name_Id (Path_Mapping.Table (Unit).Fname));
end loop; end loop;
-- Before closing the file, write the buffer to the file. -- Before closing the file, write the buffer to the file.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2003, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
-- This package keeps two mappings: from unit names to file names, -- This package keeps two mappings: from unit names to file names,
-- and from file names to path names. -- and from file names to path names.
with Types; use Types; with Namet; use Namet;
package Fmap is package Fmap is
...@@ -64,12 +64,12 @@ package Fmap is ...@@ -64,12 +64,12 @@ package Fmap is
-- for ASIS, for example) to remove any existing mappings from a previous -- for ASIS, for example) to remove any existing mappings from a previous
-- compilation. -- compilation.
procedure Add_Forbidden_File_Name (Name : Name_Id); procedure Add_Forbidden_File_Name (Name : File_Name_Type);
-- Indicate that a source file name is forbidden. -- Indicate that a source file name is forbidden.
-- This is used by gnatmake when there are Locally_Removed_Files in -- This is used by gnatmake when there are Locally_Removed_Files in
-- extending projects. -- extending projects.
procedure Remove_Forbidden_File_Name (Name : Name_Id); procedure Remove_Forbidden_File_Name (Name : File_Name_Type);
-- Indicate that a source file name that was forbidden is no longer -- Indicate that a source file name that was forbidden is no longer
-- forbidden. Used by gnatmake when a locally removed file is redefined -- forbidden. Used by gnatmake when a locally removed file is redefined
-- in another extending project. -- in another extending project.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -28,8 +28,8 @@ with Casing; use Casing; ...@@ -28,8 +28,8 @@ with Casing; use Casing;
with Fname; use Fname; with Fname; use Fname;
with Fname.UF; use Fname.UF; with Fname.UF; use Fname.UF;
with SFN_Scan; use SFN_Scan; with SFN_Scan; use SFN_Scan;
with Namet; use Namet;
with Osint; use Osint; with Osint; use Osint;
with Types; use Types;
with Unchecked_Conversion; with Unchecked_Conversion;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -28,7 +28,6 @@ with Alloc; ...@@ -28,7 +28,6 @@ with Alloc;
with Debug; use Debug; with Debug; use Debug;
with Fmap; use Fmap; with Fmap; use Fmap;
with Krunch; with Krunch;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Osint; use Osint; with Osint; use Osint;
with Table; with Table;
...@@ -194,7 +193,7 @@ package body Fname.UF is ...@@ -194,7 +193,7 @@ package body Fname.UF is
-- Null or error name means that some previous error occurred -- Null or error name means that some previous error occurred
-- This is an unrecoverable error, so signal it. -- This is an unrecoverable error, so signal it.
if Uname <= Error_Name then if Uname in Error_Unit_Name_Or_No_Unit_Name then
raise Unrecoverable_Error; raise Unrecoverable_Error;
end if; end if;
...@@ -434,7 +433,7 @@ package body Fname.UF is ...@@ -434,7 +433,7 @@ package body Fname.UF is
Debug_Flag_4); Debug_Flag_4);
end if; end if;
Fnam := File_Name_Type (Name_Find); Fnam := Name_Find;
-- If we are in the second search of the table, we accept -- If we are in the second search of the table, we accept
-- the file name without checking, because we know that -- the file name without checking, because we know that
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
-- to deal with the extra dependencies). -- to deal with the extra dependencies).
with Casing; use Casing; with Casing; use Casing;
with Types; use Types;
package Fname.UF is package Fname.UF is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
with Alloc; with Alloc;
with Hostparm; use Hostparm; with Hostparm; use Hostparm;
with Namet; use Namet;
with Table; with Table;
with Types; use Types;
package body Fname is package body Fname is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- association between source file names and unit names as defined -- association between source file names and unit names as defined
-- (see package Uname for definition of format of unit names). -- (see package Uname for definition of format of unit names).
with Types; use Types; with Namet; use Namet;
package Fname is package Fname is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -58,10 +58,10 @@ procedure Sort (Tbl : in out Unit_Ref_Table) is ...@@ -58,10 +58,10 @@ procedure Sort (Tbl : in out Unit_Ref_Table) is
-- at the bottom of the list. They are recognized because they are -- at the bottom of the list. They are recognized because they are
-- the only ones without a Unit_Name. -- the only ones without a Unit_Name.
if Units.Table (T (C1)).Unit_Name = No_Name then if Units.Table (T (C1)).Unit_Name = No_Unit_Name then
return False; return False;
elsif Units.Table (T (C2)).Unit_Name = No_Name then elsif Units.Table (T (C2)).Unit_Name = No_Unit_Name then
return True; return True;
else else
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Hostparm; with Hostparm;
with Namet; use Namet;
with Osint.C; use Osint.C; with Osint.C; use Osint.C;
package body Lib.Util is package body Lib.Util is
...@@ -142,6 +141,16 @@ package body Lib.Util is ...@@ -142,6 +141,16 @@ package body Lib.Util is
Info_Buffer_Col := Info_Buffer_Col + Name_Len; Info_Buffer_Col := Info_Buffer_Col + Name_Len;
end Write_Info_Name; end Write_Info_Name;
procedure Write_Info_Name (Name : File_Name_Type) is
begin
Write_Info_Name (Name_Id (Name));
end Write_Info_Name;
procedure Write_Info_Name (Name : Unit_Name_Type) is
begin
Write_Info_Name (Name_Id (Name));
end Write_Info_Name;
-------------------- --------------------
-- Write_Info_Nat -- -- Write_Info_Nat --
-------------------- --------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-1999 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -54,7 +54,11 @@ package Lib.Util is ...@@ -54,7 +54,11 @@ package Lib.Util is
-- Adds image of N to Info_Buffer with no leading or trailing blanks -- Adds image of N to Info_Buffer with no leading or trailing blanks
procedure Write_Info_Name (Name : Name_Id); procedure Write_Info_Name (Name : Name_Id);
-- Adds characters of Name to Info_Buffer procedure Write_Info_Name (Name : File_Name_Type);
procedure Write_Info_Name (Name : Unit_Name_Type);
-- Adds characters of Name to Info_Buffer. Note that in all cases, the
-- name is written literally from the names table entry without modifying
-- the case, using simply Get_Name_String.
procedure Write_Info_Str (Val : String); procedure Write_Info_Str (Val : String);
-- Adds characters of Val to Info_Buffer surrounded by quotes -- Adds characters of Val to Info_Buffer surrounded by quotes
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1998-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1998-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -29,7 +29,6 @@ with Csets; use Csets; ...@@ -29,7 +29,6 @@ with Csets; use Csets;
with Elists; use Elists; with Elists; use Elists;
with Errout; use Errout; with Errout; use Errout;
with Lib.Util; use Lib.Util; with Lib.Util; use Lib.Util;
with Namet; use Namet;
with Nlists; use Nlists; with Nlists; use Nlists;
with Opt; use Opt; with Opt; use Opt;
with Restrict; use Restrict; with Restrict; use Restrict;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
with Ada.Command_Line; use Ada.Command_Line; with Ada.Command_Line; use Ada.Command_Line;
with Namet; use Namet;
with Osint; use Osint; with Osint; use Osint;
with Prj.Ext; with Prj.Ext;
with Prj.Util; with Prj.Util;
...@@ -223,7 +222,7 @@ package body Makeutl is ...@@ -223,7 +222,7 @@ package body Makeutl is
end loop; end loop;
if Equal_Pos = Start if Equal_Pos = Start
or else Equal_Pos >= Finish or else Equal_Pos > Finish
then then
return False; return False;
else else
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2004-2006 Free Software Foundation, Inc. -- -- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Osint; with Osint;
with Prj; use Prj; with Prj; use Prj;
with Types; use Types; with Types; use Types;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- T e m p l a t e -- -- T e m p l a t e --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -33,6 +33,7 @@ pragma Style_Checks (All_Checks); ...@@ -33,6 +33,7 @@ pragma Style_Checks (All_Checks);
-- generated automatically in order. -- generated automatically in order.
with Atree; use Atree; -- body only with Atree; use Atree; -- body only
with Namet; use Namet; -- spec only
with Nlists; use Nlists; -- spec only with Nlists; use Nlists; -- spec only
with Sinfo; use Sinfo; -- body only with Sinfo; use Sinfo; -- body only
with Snames; use Snames; -- body only with Snames; use Snames; -- body only
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Targparm; use Targparm; with Targparm; use Targparm;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -27,11 +27,13 @@ ...@@ -27,11 +27,13 @@
-- This package contains the low level, operating system routines used in the -- This package contains the low level, operating system routines used in the
-- compiler and binder for command line processing and file input output. -- compiler and binder for command line processing and file input output.
with GNAT.OS_Lib; use GNAT.OS_Lib; with Namet; use Namet;
with System; use System; with Types; use Types;
with Types; use Types;
pragma Elaborate_All (GNAT.OS_Lib); with System.OS_Lib; use System.OS_Lib;
with System; use System;
pragma Elaborate_All (System.OS_Lib);
-- For the call to function Get_Target_Object_Suffix in the private part -- For the call to function Get_Target_Object_Suffix in the private part
package Osint is package Osint is
...@@ -150,10 +152,13 @@ package Osint is ...@@ -150,10 +152,13 @@ package Osint is
-- Same as above, with String parameters -- Same as above, with String parameters
function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type; function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
-- Returns the time stamp of file Name. Name should include relative -- Returns the time stamp of file Name. Name should include relative path
-- path information in order to locate it. If the source file cannot be -- information in order to locate it. If the source file cannot be opened,
-- opened, or Name = No_File, and all blank time stamp is returned (this is -- or Name = No_File, and all blank time stamp is returned (this is not an
-- not an error situation). -- error situation).
function File_Stamp (Name : Path_Name_Type) return Time_Stamp_Type;
-- Same as above for a path name
type String_Access_List is array (Positive range <>) of String_Access; type String_Access_List is array (Positive range <>) of String_Access;
-- Deferenced type used to return a list of file specs in -- Deferenced type used to return a list of file specs in
...@@ -376,8 +381,8 @@ package Osint is ...@@ -376,8 +381,8 @@ package Osint is
function Full_Source_Name (N : File_Name_Type) return File_Name_Type; function Full_Source_Name (N : File_Name_Type) return File_Name_Type;
function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type; function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of the source file whose simple name is -- Returns the full name/time stamp of the source file whose simple name
-- N which should not include path information. Note that if the file -- is N which should not include path information. Note that if the file
-- cannot be located No_File is returned for the first routine and an all -- cannot be located No_File is returned for the first routine and an all
-- blank time stamp is returned for the second (this is not an error -- blank time stamp is returned for the second (this is not an error
-- situation). The full name includes appropriate directory information. -- situation). The full name includes appropriate directory information.
...@@ -491,13 +496,12 @@ package Osint is ...@@ -491,13 +496,12 @@ package Osint is
function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type; function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type; function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of library file N. N should not -- Returns the full name/time stamp of library file N. N should not include
-- include path information. Note that if the file cannot be located -- path information. Note that if the file cannot be located No_File is
-- No_File is returned for the first routine and an all blank time stamp -- returned for the first routine and an all blank time stamp is returned
-- is returned for the second (this is not an error situation). The -- for the second (this is not an error situation). The full name includes
-- full name includes the appropriate directory information. The library -- the appropriate directory information. The library file directory lookup
-- file directory lookup penalty is incurred every single time this -- penalty is incurred every single time this routine is called.
-- routine is called.
function Lib_File_Name function Lib_File_Name
(Source_File : File_Name_Type; (Source_File : File_Name_Type;
...@@ -601,7 +605,7 @@ private ...@@ -601,7 +605,7 @@ private
-- length in Name_Len), and place the resulting descriptor in Fdesc. Issue -- length in Name_Len), and place the resulting descriptor in Fdesc. Issue
-- message and exit with fatal error if file cannot be created. The Fmode -- message and exit with fatal error if file cannot be created. The Fmode
-- parameter is set to either Text or Binary (for details see description -- parameter is set to either Text or Binary (for details see description
-- of GNAT.OS_Lib.Create_File). -- of System.OS_Lib.Create_File).
type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified); type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
-- Program currently running -- Program currently running
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -147,7 +147,7 @@ begin ...@@ -147,7 +147,7 @@ begin
-- If we have no unit name, things are seriously messed up by previous -- If we have no unit name, things are seriously messed up by previous
-- errors, and we should not try to continue compilation. -- errors, and we should not try to continue compilation.
if Unit_Name (Cur_Unum) = No_Name then if Unit_Name (Cur_Unum) = No_Unit_Name then
raise Unrecoverable_Error; raise Unrecoverable_Error;
end if; end if;
...@@ -170,7 +170,7 @@ begin ...@@ -170,7 +170,7 @@ begin
or not Same_File_Name_Except_For_Case or not Same_File_Name_Except_For_Case
(File_Name, Unit_File_Name (Cur_Unum))) (File_Name, Unit_File_Name (Cur_Unum)))
then then
Error_Msg_Name_1 := File_Name; Error_Msg_File_1 := File_Name;
Error_Msg Error_Msg
("?file name does not match unit name, should be{", Sloc (Curunit)); ("?file name does not match unit name, should be{", Sloc (Curunit));
end if; end if;
...@@ -184,8 +184,8 @@ begin ...@@ -184,8 +184,8 @@ begin
and then Expected_Unit (Cur_Unum) /= Unit_Name (Cur_Unum) and then Expected_Unit (Cur_Unum) /= Unit_Name (Cur_Unum)
then then
Loc := Error_Location (Cur_Unum); Loc := Error_Location (Cur_Unum);
Error_Msg_Name_1 := Unit_File_Name (Cur_Unum); Error_Msg_File_1 := Unit_File_Name (Cur_Unum);
Get_Name_String (Error_Msg_Name_1); Get_Name_String (Error_Msg_File_1);
-- Check for predefined file case -- Check for predefined file case
...@@ -200,12 +200,12 @@ begin ...@@ -200,12 +200,12 @@ begin
Name_Buffer (1) = 'g') Name_Buffer (1) = 'g')
then then
declare declare
Expect_Name : constant Name_Id := Expected_Unit (Cur_Unum); Expect_Name : constant Unit_Name_Type := Expected_Unit (Cur_Unum);
Actual_Name : constant Name_Id := Unit_Name (Cur_Unum); Actual_Name : constant Unit_Name_Type := Unit_Name (Cur_Unum);
begin begin
Error_Msg_Name_1 := Expect_Name; Error_Msg_Unit_1 := Expect_Name;
Error_Msg ("% is not a predefined library unit!", Loc); Error_Msg ("$$ is not a predefined library unit!", Loc);
-- In the predefined file case, we know the user did not -- In the predefined file case, we know the user did not
-- construct their own package, but we got the wrong one. -- construct their own package, but we got the wrong one.
...@@ -222,15 +222,15 @@ begin ...@@ -222,15 +222,15 @@ begin
-- of misspelling of predefined unit names without needing -- of misspelling of predefined unit names without needing
-- a full list of them. -- a full list of them.
-- Before actually issinying the message, we will check that the -- Before actually issuing the message, we will check that the
-- unit name is indeed a plausible misspelling of the one we got. -- unit name is indeed a plausible misspelling of the one we got.
if Is_Bad_Spelling_Of if Is_Bad_Spelling_Of
(Found => Get_Name_String (Expect_Name), (Found => Get_Name_String (Expect_Name),
Expect => Get_Name_String (Actual_Name)) Expect => Get_Name_String (Actual_Name))
then then
Error_Msg_Name_1 := Actual_Name; Error_Msg_Unit_1 := Actual_Name;
Error_Msg ("possible misspelling of %!", Loc); Error_Msg ("possible misspelling of $$!", Loc);
end if; end if;
end; end;
...@@ -319,7 +319,7 @@ begin ...@@ -319,7 +319,7 @@ begin
Spec_Name := Get_Parent_Spec_Name (Unit_Name (Cur_Unum)); Spec_Name := Get_Parent_Spec_Name (Unit_Name (Cur_Unum));
if Spec_Name /= No_Name then if Spec_Name /= No_Unit_Name then
Unum := Unum :=
Load_Unit Load_Unit
(Load_Name => Spec_Name, (Load_Name => Spec_Name,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Osint; with Osint;
with Prj.Com; use Prj.Com; with Prj.Com; use Prj.Com;
with System.Case_Util; use System.Case_Util; with System.Case_Util; use System.Case_Util;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Err_Vars; use Err_Vars; with Err_Vars; use Err_Vars;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Prj.Err; use Prj.Err; with Prj.Err; use Prj.Err;
with Prj.Strt; use Prj.Strt; with Prj.Strt; use Prj.Strt;
...@@ -209,7 +208,7 @@ package body Prj.Dect is ...@@ -209,7 +208,7 @@ package body Prj.Dect is
if not Ignore then if not Ignore then
Error_Msg_Name_1 := Token_Name; Error_Msg_Name_1 := Token_Name;
Error_Msg ("undefined attribute {", Token_Ptr); Error_Msg ("undefined attribute %%", Token_Ptr);
end if; end if;
end if; end if;
...@@ -1131,7 +1130,7 @@ package body Prj.Dect is ...@@ -1131,7 +1130,7 @@ package body Prj.Dect is
and then Token_Name /= Name_Of (Package_Declaration, In_Tree) and then Token_Name /= Name_Of (Package_Declaration, In_Tree)
then then
Error_Msg_Name_1 := Name_Of (Package_Declaration, In_Tree); Error_Msg_Name_1 := Name_Of (Package_Declaration, In_Tree);
Error_Msg ("expected {", Token_Ptr); Error_Msg ("expected %", Token_Ptr);
end if; end if;
if Token /= Tok_Semicolon then if Token /= Tok_Semicolon then
...@@ -1252,13 +1251,13 @@ package body Prj.Dect is ...@@ -1252,13 +1251,13 @@ package body Prj.Dect is
Current_Package : Project_Node_Id) Current_Package : Project_Node_Id)
is is
Expression_Location : Source_Ptr; Expression_Location : Source_Ptr;
String_Type_Name : Name_Id := No_Name; String_Type_Name : Name_Id := No_Name;
Project_String_Type_Name : Name_Id := No_Name; Project_String_Type_Name : Name_Id := No_Name;
Type_Location : Source_Ptr := No_Location; Type_Location : Source_Ptr := No_Location;
Project_Location : Source_Ptr := No_Location; Project_Location : Source_Ptr := No_Location;
Expression : Project_Node_Id := Empty_Node; Expression : Project_Node_Id := Empty_Node;
Variable_Name : constant Name_Id := Token_Name; Variable_Name : constant Name_Id := Token_Name;
OK : Boolean := True; OK : Boolean := True;
begin begin
Variable := Variable :=
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2002-2004 Free Software Foundation, Inc. -- -- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Output; use Output; with Output; use Output;
with Stringt; use Stringt; with Stringt; use Stringt;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Csets; with Csets;
with Namet; use Namet;
with Opt; with Opt;
with Output; with Output;
with Osint; use Osint; with Osint; use Osint;
...@@ -40,10 +39,10 @@ with Table; use Table; ...@@ -40,10 +39,10 @@ with Table; use Table;
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.Regexp; use GNAT.Regexp;
with System.Case_Util; use System.Case_Util; with System.Case_Util; use System.Case_Util;
with System.CRTL; with System.CRTL;
with System.Regexp; use System.Regexp;
package body Prj.Makr is package body Prj.Makr is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Characters.Handling; use Ada.Characters.Handling;
with Namet; use Namet;
with Output; use Output; with Output; use Output;
with Snames; with Snames;
...@@ -94,6 +93,7 @@ package body Prj.PP is ...@@ -94,6 +93,7 @@ package body Prj.PP is
-- Outputs the indentation at the beginning of the line -- Outputs the indentation at the beginning of the line
procedure Output_String (S : Name_Id); procedure Output_String (S : Name_Id);
procedure Output_String (S : Path_Name_Type);
-- Outputs a string using the default output procedures -- Outputs a string using the default output procedures
procedure Write_Empty_Line (Always : Boolean := False); procedure Write_Empty_Line (Always : Boolean := False);
...@@ -229,6 +229,11 @@ package body Prj.PP is ...@@ -229,6 +229,11 @@ package body Prj.PP is
Column := Column + 1; Column := Column + 1;
end Output_String; end Output_String;
procedure Output_String (S : Path_Name_Type) is
begin
Output_String (Name_Id (S));
end Output_String;
---------------- ----------------
-- Start_Line -- -- Start_Line --
---------------- ----------------
...@@ -335,7 +340,7 @@ package body Prj.PP is ...@@ -335,7 +340,7 @@ package body Prj.PP is
-- Check if this project extends another project -- Check if this project extends another project
if Extended_Project_Path_Of (Node, In_Tree) /= No_Name then if Extended_Project_Path_Of (Node, In_Tree) /= No_Path then
Write_String (" extends "); Write_String (" extends ");
if Is_Extending_All (Node, In_Tree) then if Is_Extending_All (Node, In_Tree) then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Err_Vars; use Err_Vars; with Err_Vars; use Err_Vars;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Osint; use Osint; with Osint; use Osint;
with Output; use Output; with Output; use Output;
...@@ -142,7 +141,7 @@ package body Prj.Proc is ...@@ -142,7 +141,7 @@ package body Prj.Proc is
procedure Add (To_Exp : in out Name_Id; Str : Name_Id) is procedure Add (To_Exp : in out Name_Id; Str : Name_Id) is
begin begin
if To_Exp = Types.No_Name or else To_Exp = Empty_String then if To_Exp = No_Name or else To_Exp = Empty_String then
-- To_Exp is nil or empty. The result is Str -- To_Exp is nil or empty. The result is Str
...@@ -568,17 +567,19 @@ package body Prj.Proc is ...@@ -568,17 +567,19 @@ package body Prj.Proc is
when N_Variable_Reference | N_Attribute_Reference => when N_Variable_Reference | N_Attribute_Reference =>
declare declare
The_Project : Project_Id := Project; The_Project : Project_Id := Project;
The_Package : Package_Id := Pkg; The_Package : Package_Id := Pkg;
The_Name : Name_Id := No_Name; The_Name : Name_Id := No_Name;
The_Variable_Id : Variable_Id := No_Variable; The_Variable_Id : Variable_Id := No_Variable;
The_Variable : Variable_Value; The_Variable : Variable_Value;
Term_Project : constant Project_Node_Id := Term_Project : constant Project_Node_Id :=
Project_Node_Of Project_Node_Of
(The_Current_Term, From_Project_Node_Tree); (The_Current_Term,
From_Project_Node_Tree);
Term_Package : constant Project_Node_Id := Term_Package : constant Project_Node_Id :=
Package_Node_Of Package_Node_Of
(The_Current_Term, From_Project_Node_Tree); (The_Current_Term,
From_Project_Node_Tree);
Index : Name_Id := No_Name; Index : Name_Id := No_Name;
begin begin
...@@ -589,6 +590,7 @@ package body Prj.Proc is ...@@ -589,6 +590,7 @@ package body Prj.Proc is
The_Name := The_Name :=
Name_Of (Term_Project, From_Project_Node_Tree); Name_Of (Term_Project, From_Project_Node_Tree);
The_Project := Imported_Or_Extended_Project_From The_Project := Imported_Or_Extended_Project_From
(Project => Project, (Project => Project,
In_Tree => In_Tree, In_Tree => In_Tree,
...@@ -601,6 +603,7 @@ package body Prj.Proc is ...@@ -601,6 +603,7 @@ package body Prj.Proc is
The_Name := The_Name :=
Name_Of (Term_Package, From_Project_Node_Tree); Name_Of (Term_Package, From_Project_Node_Tree);
The_Package := In_Tree.Projects.Table The_Package := In_Tree.Projects.Table
(The_Project).Decl.Packages; (The_Project).Decl.Packages;
...@@ -1139,7 +1142,7 @@ package body Prj.Proc is ...@@ -1139,7 +1142,7 @@ package body Prj.Proc is
Follow_Links : Boolean := True; Follow_Links : Boolean := True;
When_No_Sources : Error_Warning := Error) When_No_Sources : Error_Warning := Error)
is is
Obj_Dir : Name_Id; Obj_Dir : Path_Name_Type;
Extending : Project_Id; Extending : Project_Id;
Extending2 : Project_Id; Extending2 : Project_Id;
...@@ -1174,7 +1177,7 @@ package body Prj.Proc is ...@@ -1174,7 +1177,7 @@ package body Prj.Proc is
and then Is_Extending_All (From_Project_Node, From_Project_Node_Tree) and then Is_Extending_All (From_Project_Node, From_Project_Node_Tree)
then then
declare declare
Object_Dir : constant Name_Id := Object_Dir : constant Path_Name_Type :=
In_Tree.Projects.Table (Project).Object_Directory; In_Tree.Projects.Table (Project).Object_Directory;
begin begin
for Index in for Index in
...@@ -1219,7 +1222,7 @@ package body Prj.Proc is ...@@ -1219,7 +1222,7 @@ package body Prj.Proc is
if Error_Report = null then if Error_Report = null then
Error_Msg Error_Msg
("project { cannot be extended by a virtual " & ("project % cannot be extended by a virtual " &
"project with the same object directory", "project with the same object directory",
In_Tree.Projects.Table (Proj).Location); In_Tree.Projects.Table (Proj).Location);
else else
...@@ -1239,7 +1242,7 @@ package body Prj.Proc is ...@@ -1239,7 +1242,7 @@ package body Prj.Proc is
if Error_Report = null then if Error_Report = null then
Error_Msg Error_Msg
("project { cannot extend project {", ("project %% cannot extend project %%",
In_Tree.Projects.Table (Extending2).Location); In_Tree.Projects.Table (Extending2).Location);
Error_Msg Error_Msg
("\they share the same object directory", ("\they share the same object directory",
...@@ -1436,7 +1439,9 @@ package body Prj.Proc is ...@@ -1436,7 +1439,9 @@ package body Prj.Proc is
declare declare
Current_Item_Name : constant Name_Id := Current_Item_Name : constant Name_Id :=
Name_Of (Current_Item, From_Project_Node_Tree); Name_Of
(Current_Item,
From_Project_Node_Tree);
-- The name of the attribute -- The name of the attribute
New_Array : Array_Id; New_Array : Array_Id;
...@@ -1529,10 +1534,10 @@ package body Prj.Proc is ...@@ -1529,10 +1534,10 @@ package body Prj.Proc is
-- Find the project where the value is declared -- Find the project where the value is declared
Orig_Project_Name := Orig_Project_Name :=
Name_Of Name_Of
(Associative_Project_Of (Associative_Project_Of
(Current_Item, From_Project_Node_Tree), (Current_Item, From_Project_Node_Tree),
From_Project_Node_Tree); From_Project_Node_Tree);
for Index in Project_Table.First .. for Index in Project_Table.First ..
Project_Table.Last Project_Table.Last
...@@ -1786,7 +1791,8 @@ package body Prj.Proc is ...@@ -1786,7 +1791,8 @@ package body Prj.Proc is
if Error_Report = null then if Error_Report = null then
Error_Msg Error_Msg
("value { is illegal for typed string %", ("value %% is illegal for "
& "typed string %",
Location_Of Location_Of
(Current_Item, (Current_Item,
From_Project_Node_Tree)); From_Project_Node_Tree));
...@@ -1799,6 +1805,10 @@ package body Prj.Proc is ...@@ -1799,6 +1805,10 @@ package body Prj.Proc is
Get_Name_String (Error_Msg_Name_2) & Get_Name_String (Error_Msg_Name_2) &
"""", """",
Project, In_Tree); Project, In_Tree);
-- Calls like this to Error_Report are
-- wrong, since they don't properly case
-- and decode names corresponding to the
-- ordinary case of % insertion ???
end if; end if;
end if; end if;
end; end;
...@@ -2404,7 +2414,8 @@ package body Prj.Proc is ...@@ -2404,7 +2414,8 @@ package body Prj.Proc is
Location_Of (From_Project_Node, From_Project_Node_Tree); Location_Of (From_Project_Node, From_Project_Node_Tree);
Processed_Data.Display_Directory := Processed_Data.Display_Directory :=
Directory_Of (From_Project_Node, From_Project_Node_Tree); Path_Name_Type
(Directory_Of (From_Project_Node, From_Project_Node_Tree));
Get_Name_String (Processed_Data.Display_Directory); Get_Name_String (Processed_Data.Display_Directory);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Processed_Data.Directory := Name_Find; Processed_Data.Directory := Name_Find;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -111,13 +111,13 @@ package body Prj.Tree is ...@@ -111,13 +111,13 @@ package body Prj.Tree is
(Kind => N_Comment_Zones, (Kind => N_Comment_Zones,
Expr_Kind => Undefined, Expr_Kind => Undefined,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => No_Name, Value => No_Name,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -159,13 +159,13 @@ package body Prj.Tree is ...@@ -159,13 +159,13 @@ package body Prj.Tree is
Flag2 => Flag2 =>
Comments.Table (J).Is_Followed_By_Empty_Line, Comments.Table (J).Is_Followed_By_Empty_Line,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => Comments.Table (J).Value, Value => Comments.Table (J).Value,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -323,14 +323,14 @@ package body Prj.Tree is ...@@ -323,14 +323,14 @@ package body Prj.Tree is
In_Tree.Project_Nodes.Table (Zone) := In_Tree.Project_Nodes.Table (Zone) :=
(Kind => N_Comment_Zones, (Kind => N_Comment_Zones,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Expr_Kind => Undefined, Expr_Kind => Undefined,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => No_Name, Value => No_Name,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -397,14 +397,14 @@ package body Prj.Tree is ...@@ -397,14 +397,14 @@ package body Prj.Tree is
(Project_Node_Table.Last (In_Tree.Project_Nodes)) := (Project_Node_Table.Last (In_Tree.Project_Nodes)) :=
(Kind => Of_Kind, (Kind => Of_Kind,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Expr_Kind => And_Expr_Kind, Expr_Kind => And_Expr_Kind,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => No_Name, Value => No_Name,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -432,13 +432,13 @@ package body Prj.Tree is ...@@ -432,13 +432,13 @@ package body Prj.Tree is
(Kind => N_Comment_Zones, (Kind => N_Comment_Zones,
Expr_Kind => Undefined, Expr_Kind => Undefined,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => No_Name, Value => No_Name,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -464,13 +464,13 @@ package body Prj.Tree is ...@@ -464,13 +464,13 @@ package body Prj.Tree is
Flag2 => Flag2 =>
Comments.Table (J).Is_Followed_By_Empty_Line, Comments.Table (J).Is_Followed_By_Empty_Line,
Location => No_Location, Location => No_Location,
Directory => No_Name, Directory => No_Path,
Variables => Empty_Node, Variables => Empty_Node,
Packages => Empty_Node, Packages => Empty_Node,
Pkg_Id => Empty_Package, Pkg_Id => Empty_Package,
Name => No_Name, Name => No_Name,
Src_Index => 0, Src_Index => 0,
Path_Name => No_Name, Path_Name => No_Path,
Value => Comments.Table (J).Value, Value => Comments.Table (J).Value,
Field1 => Empty_Node, Field1 => Empty_Node,
Field2 => Empty_Node, Field2 => Empty_Node,
...@@ -510,7 +510,7 @@ package body Prj.Tree is ...@@ -510,7 +510,7 @@ package body Prj.Tree is
function Directory_Of function Directory_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id is In_Tree : Project_Node_Tree_Ref) return Path_Name_Type is
begin begin
pragma Assert pragma Assert
(Node /= Empty_Node (Node /= Empty_Node
...@@ -619,14 +619,14 @@ package body Prj.Tree is ...@@ -619,14 +619,14 @@ package body Prj.Tree is
function Extended_Project_Path_Of function Extended_Project_Path_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id In_Tree : Project_Node_Tree_Ref) return Path_Name_Type
is is
begin begin
pragma Assert pragma Assert
(Node /= Empty_Node (Node /= Empty_Node
and then and then
In_Tree.Project_Nodes.Table (Node).Kind = N_Project); In_Tree.Project_Nodes.Table (Node).Kind = N_Project);
return In_Tree.Project_Nodes.Table (Node).Value; return Path_Name_Type (In_Tree.Project_Nodes.Table (Node).Value);
end Extended_Project_Path_Of; end Extended_Project_Path_Of;
-------------------------- --------------------------
...@@ -1325,7 +1325,7 @@ package body Prj.Tree is ...@@ -1325,7 +1325,7 @@ package body Prj.Tree is
function Path_Name_Of function Path_Name_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id In_Tree : Project_Node_Tree_Ref) return Path_Name_Type
is is
begin begin
pragma Assert pragma Assert
...@@ -1716,7 +1716,7 @@ package body Prj.Tree is ...@@ -1716,7 +1716,7 @@ package body Prj.Tree is
procedure Set_Directory_Of procedure Set_Directory_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id) To : Path_Name_Type)
is is
begin begin
pragma Assert pragma Assert
...@@ -2187,14 +2187,14 @@ package body Prj.Tree is ...@@ -2187,14 +2187,14 @@ package body Prj.Tree is
procedure Set_Extended_Project_Path_Of procedure Set_Extended_Project_Path_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id) To : Path_Name_Type)
is is
begin begin
pragma Assert pragma Assert
(Node /= Empty_Node (Node /= Empty_Node
and then and then
In_Tree.Project_Nodes.Table (Node).Kind = N_Project); In_Tree.Project_Nodes.Table (Node).Kind = N_Project);
In_Tree.Project_Nodes.Table (Node).Value := To; In_Tree.Project_Nodes.Table (Node).Value := Name_Id (To);
end Set_Extended_Project_Path_Of; end Set_Extended_Project_Path_Of;
------------------------------ ------------------------------
...@@ -2422,7 +2422,7 @@ package body Prj.Tree is ...@@ -2422,7 +2422,7 @@ package body Prj.Tree is
procedure Set_Path_Name_Of procedure Set_Path_Name_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id) To : Path_Name_Type)
is is
begin begin
pragma Assert pragma Assert
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -266,7 +266,7 @@ package Prj.Tree is ...@@ -266,7 +266,7 @@ package Prj.Tree is
function Directory_Of function Directory_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id; In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Directory_Of); pragma Inline (Directory_Of);
-- Only valid for N_Project nodes -- Only valid for N_Project nodes
...@@ -310,7 +310,7 @@ package Prj.Tree is ...@@ -310,7 +310,7 @@ package Prj.Tree is
function Path_Name_Of function Path_Name_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id; In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Path_Name_Of); pragma Inline (Path_Name_Of);
-- Only valid for N_Project and N_With_Clause nodes -- Only valid for N_Project and N_With_Clause nodes
...@@ -354,7 +354,7 @@ package Prj.Tree is ...@@ -354,7 +354,7 @@ package Prj.Tree is
function Extended_Project_Path_Of function Extended_Project_Path_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id; In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
pragma Inline (Extended_Project_Path_Of); pragma Inline (Extended_Project_Path_Of);
-- Only valid for N_With_Clause nodes -- Only valid for N_With_Clause nodes
...@@ -629,7 +629,7 @@ package Prj.Tree is ...@@ -629,7 +629,7 @@ package Prj.Tree is
procedure Set_Directory_Of procedure Set_Directory_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id); To : Path_Name_Type);
pragma Inline (Set_Directory_Of); pragma Inline (Set_Directory_Of);
procedure Set_Expression_Kind_Of procedure Set_Expression_Kind_Of
...@@ -669,7 +669,7 @@ package Prj.Tree is ...@@ -669,7 +669,7 @@ package Prj.Tree is
procedure Set_Path_Name_Of procedure Set_Path_Name_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id); To : Path_Name_Type);
pragma Inline (Set_Path_Name_Of); pragma Inline (Set_Path_Name_Of);
procedure Set_String_Value_Of procedure Set_String_Value_Of
...@@ -705,7 +705,7 @@ package Prj.Tree is ...@@ -705,7 +705,7 @@ package Prj.Tree is
procedure Set_Extended_Project_Path_Of procedure Set_Extended_Project_Path_Of
(Node : Project_Node_Id; (Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref; In_Tree : Project_Node_Tree_Ref;
To : Name_Id); To : Path_Name_Type);
pragma Inline (Set_Extended_Project_Path_Of); pragma Inline (Set_Extended_Project_Path_Of);
procedure Set_Project_Node_Of procedure Set_Project_Node_Of
...@@ -900,8 +900,9 @@ package Prj.Tree is ...@@ -900,8 +900,9 @@ package Prj.Tree is
package Tree_Private_Part is package Tree_Private_Part is
-- This is conceptually in the private part. -- This is conceptually in the private part
-- However, for efficiency, some packages are accessing it directly.
-- However, for efficiency, some packages are accessing it directly
type Project_Node_Record is record type Project_Node_Record is record
...@@ -909,7 +910,7 @@ package Prj.Tree is ...@@ -909,7 +910,7 @@ package Prj.Tree is
Location : Source_Ptr := No_Location; Location : Source_Ptr := No_Location;
Directory : Name_Id := No_Name; Directory : Path_Name_Type := No_Path;
-- Only for N_Project -- Only for N_Project
Expr_Kind : Variable_Kind := Undefined; Expr_Kind : Variable_Kind := Undefined;
...@@ -938,7 +939,7 @@ package Prj.Tree is ...@@ -938,7 +939,7 @@ package Prj.Tree is
-- Index of a unit in a multi-unit source. -- Index of a unit in a multi-unit source.
-- Onli for some N_Attribute_Declaration and N_Literal_String. -- Onli for some N_Attribute_Declaration and N_Literal_String.
Path_Name : Name_Id := No_Name; Path_Name : Path_Name_Type := No_Path;
-- See below for what Project_Node_Kind it is used -- See below for what Project_Node_Kind it is used
Value : Name_Id := No_Name; Value : Name_Id := No_Name;
...@@ -1204,7 +1205,7 @@ package Prj.Tree is ...@@ -1204,7 +1205,7 @@ package Prj.Tree is
Node : Project_Node_Id; Node : Project_Node_Id;
-- Node of the project in table Project_Nodes -- Node of the project in table Project_Nodes
Canonical_Path : Name_Id; Canonical_Path : Path_Name_Type;
-- Resolved and canonical path of the project file -- Resolved and canonical path of the project file
Extended : Boolean; Extended : Boolean;
...@@ -1214,7 +1215,7 @@ package Prj.Tree is ...@@ -1214,7 +1215,7 @@ package Prj.Tree is
No_Project_Name_And_Node : constant Project_Name_And_Node := No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name, (Name => No_Name,
Node => Empty_Node, Node => Empty_Node,
Canonical_Path => No_Name, Canonical_Path => No_Path,
Extended => True); Extended => True);
package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable
...@@ -1226,9 +1227,8 @@ package Prj.Tree is ...@@ -1226,9 +1227,8 @@ package Prj.Tree is
Equal => "="); Equal => "=");
-- This hash table contains a mapping of project names to project nodes. -- This hash table contains a mapping of project names to project nodes.
-- Note that this hash table contains only the nodes whose Kind is -- Note that this hash table contains only the nodes whose Kind is
-- N_Project. It is used to find the node of a project from its -- N_Project. It is used to find the node of a project from its name,
-- name, and to verify if a project has already been parsed, knowing -- and to verify if a project has already been parsed, knowing its name.
-- its name.
end Tree_Private_Part; end Tree_Private_Part;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,9 +26,8 @@ ...@@ -26,9 +26,8 @@
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with GNAT.Case_Util; use GNAT.Case_Util; with System.Case_Util; use System.Case_Util;
with Namet; use Namet;
with Osint; use Osint; with Osint; use Osint;
with Output; use Output; with Output; use Output;
with Prj.Com; with Prj.Com;
...@@ -77,9 +76,9 @@ package body Prj.Util is ...@@ -77,9 +76,9 @@ package body Prj.Util is
function Executable_Of function Executable_Of
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
Main : Name_Id; Main : File_Name_Type;
Index : Int; Index : Int;
Ada_Main : Boolean := True) return Name_Id Ada_Main : Boolean := True) return File_Name_Type
is is
pragma Assert (Project /= No_Project); pragma Assert (Project /= No_Project);
...@@ -94,7 +93,7 @@ package body Prj.Util is ...@@ -94,7 +93,7 @@ package body Prj.Util is
Executable : Variable_Value := Executable : Variable_Value :=
Prj.Util.Value_Of Prj.Util.Value_Of
(Name => Main, (Name => Name_Id (Main),
Index => Index, Index => Index,
Attribute_Or_Array_Name => Name_Executable, Attribute_Or_Array_Name => Name_Executable,
In_Package => Builder_Package, In_Package => Builder_Package,
...@@ -184,7 +183,7 @@ package body Prj.Util is ...@@ -184,7 +183,7 @@ package body Prj.Util is
declare declare
Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; Saved_EEOT : constant Name_Id := Executable_Extension_On_Target;
Result : Name_Id; Result : File_Name_Type;
begin begin
if Executable_Suffix /= Nil_Variable_Value if Executable_Suffix /= Nil_Variable_Value
...@@ -193,7 +192,7 @@ package body Prj.Util is ...@@ -193,7 +192,7 @@ package body Prj.Util is
Executable_Extension_On_Target := Executable_Suffix.Value; Executable_Extension_On_Target := Executable_Suffix.Value;
end if; end if;
Result := Executable_Name (Executable.Value); Result := Executable_Name (File_Name_Type (Executable.Value));
Executable_Extension_On_Target := Saved_EEOT; Executable_Extension_On_Target := Saved_EEOT;
return Result; return Result;
end; end;
...@@ -348,7 +347,7 @@ package body Prj.Util is ...@@ -348,7 +347,7 @@ package body Prj.Util is
File_Name (1 .. Name'Length) := Name; File_Name (1 .. Name'Length) := Name;
File_Name (File_Name'Last) := ASCII.NUL; File_Name (File_Name'Last) := ASCII.NUL;
FD := Open_Read (Name => File_Name'Address, FD := Open_Read (Name => File_Name'Address,
Fmode => GNAT.OS_Lib.Text); Fmode => GNAT.OS_Lib.Text);
if FD = Invalid_FD then if FD = Invalid_FD then
File := null; File := null;
else else
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,9 +31,9 @@ package Prj.Util is ...@@ -31,9 +31,9 @@ package Prj.Util is
function Executable_Of function Executable_Of
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
Main : Name_Id; Main : File_Name_Type;
Index : Int; Index : Int;
Ada_Main : Boolean := True) return Name_Id; Ada_Main : Boolean := True) return File_Name_Type;
-- Return the value of the attribute Builder'Executable for file Main in -- Return the value of the attribute Builder'Executable for file Main in
-- the project Project, if it exists. If there is no attribute Executable -- the project Project, if it exists. If there is no attribute Executable
-- for Main, remove the suffix from Main; then, if the attribute -- for Main, remove the suffix from Main; then, if the attribute
...@@ -62,9 +62,8 @@ package Prj.Util is ...@@ -62,9 +62,8 @@ package Prj.Util is
Src_Index : Int := 0; Src_Index : Int := 0;
In_Array : Array_Element_Id; In_Array : Array_Element_Id;
In_Tree : Project_Tree_Ref) return Variable_Value; In_Tree : Project_Tree_Ref) return Variable_Value;
-- Get a string array component (single String or String list). -- Get a string array component (single String or String list). Returns
-- Returns Nil_Variable_Value if there is no component Index -- Nil_Variable_Value if no component Index or if In_Array is null.
-- or if In_Array is null.
-- --
-- Depending on the attribute (only attributes may be associative arrays) -- Depending on the attribute (only attributes may be associative arrays)
-- the index may or may not be case sensitive. If the index is not case -- the index may or may not be case sensitive. If the index is not case
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Snames; use Snames; with Snames; use Snames;
package body Scans is package body Scans is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Types; use Types; with Types; use Types;
with Uintp; use Uintp; with Uintp; use Uintp;
with Urealp; use Urealp; with Urealp; use Urealp;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
with Atree; use Atree; with Atree; use Atree;
with Errout; use Errout; with Errout; use Errout;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Restrict; use Restrict; with Restrict; use Restrict;
with Rident; use Rident; with Rident; use Rident;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -24,13 +24,12 @@ ...@@ -24,13 +24,12 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with System; use System; with System; use System;
with Ada.Unchecked_Conversion; with Ada.Unchecked_Conversion;
with GNAT.OS_Lib; use GNAT.OS_Lib; with System.OS_Lib; use System.OS_Lib;
package body Sinput.C is package body Sinput.C is
...@@ -53,8 +52,8 @@ package body Sinput.C is ...@@ -53,8 +52,8 @@ package body Sinput.C is
Actual_Len : Integer; Actual_Len : Integer;
Path_Id : Name_Id; Path_Id : File_Name_Type;
File_Id : Name_Id; File_Id : File_Name_Type;
begin begin
if Path = "" then if Path = "" then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -227,7 +227,7 @@ package body Styleg.C is ...@@ -227,7 +227,7 @@ package body Styleg.C is
Set_Casing (Cas); Set_Casing (Cas);
Error_Msg_Name_1 := Name_Enter; Error_Msg_Name_1 := Name_Enter;
Error_Msg_N Error_Msg_N
("(style) bad casing of { declared in Standard", Ref); ("(style) bad casing of %% declared in Standard", Ref);
end if; end if;
end if; end if;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2003-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with Namet; use Namet;
with Opt; use Opt; with Opt; use Opt;
with Output; use Output; with Output; use Output;
...@@ -38,9 +37,13 @@ package body Tempdir is ...@@ -38,9 +37,13 @@ package body Tempdir is
No_Dir : aliased String := ""; No_Dir : aliased String := "";
Temp_Dir : String_Access := No_Dir'Access; Temp_Dir : String_Access := No_Dir'Access;
----------------------
-- Create_Temp_File --
----------------------
procedure Create_Temp_File procedure Create_Temp_File
(FD : out File_Descriptor; (FD : out File_Descriptor;
Name : out Name_Id) Name : out Path_Name_Type)
is is
File_Name : String_Access; File_Name : String_Access;
Current_Dir : constant String := Get_Current_Dir; Current_Dir : constant String := Get_Current_Dir;
...@@ -90,13 +93,13 @@ package body Tempdir is ...@@ -90,13 +93,13 @@ package body Tempdir is
end if; end if;
if FD = Invalid_FD then if FD = Invalid_FD then
Name := No_Name; Name := No_Path;
else else
declare declare
Path_Name : constant String := Path_Name : constant String :=
Normalize_Pathname Normalize_Pathname
(Directory & Directory_Separator & File_Name.all); (Directory & Directory_Separator & File_Name.all);
begin begin
Name_Len := Path_Name'Length; Name_Len := Path_Name'Length;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2003 Free Software Foundation, Inc. -- -- Copyright (C) 2003-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -29,14 +29,15 @@ ...@@ -29,14 +29,15 @@
-- designates an absolute path, temporary files are create in this directory. -- designates an absolute path, temporary files are create in this directory.
-- Otherwise, temporary files are created in the current working directory. -- Otherwise, temporary files are created in the current working directory.
with GNAT.OS_Lib; use GNAT.OS_Lib; with Namet; use Namet;
with Types; use Types;
with System.OS_Lib; use System.OS_Lib;
package Tempdir is package Tempdir is
procedure Create_Temp_File procedure Create_Temp_File
(FD : out File_Descriptor; (FD : out File_Descriptor;
Name : out Name_Id); Name : out Path_Name_Type);
-- Create a temporary text file and return its file descriptor and -- Create a temporary text file and return its file descriptor and
-- its path name as a Name_Id. If environment variable TMPDIR is defined -- its path name as a Name_Id. If environment variable TMPDIR is defined
-- and its value is an absolute path, the temp file is created in the -- and its value is an absolute path, the temp file is created in the
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -36,7 +36,6 @@ with Casing; use Casing; ...@@ -36,7 +36,6 @@ with Casing; use Casing;
with Einfo; use Einfo; with Einfo; use Einfo;
with Hostparm; with Hostparm;
with Lib; use Lib; with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists; with Nlists; use Nlists;
with Output; use Output; with Output; use Output;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
...@@ -138,7 +137,7 @@ package body Uname is ...@@ -138,7 +137,7 @@ package body Uname is
while Name_Buffer (Name_Len) /= '.' loop while Name_Buffer (Name_Len) /= '.' loop
if Name_Len = 1 then if Name_Len = 1 then
return No_Name; -- not a child or subunit name return No_Unit_Name;
else else
Name_Len := Name_Len - 1; Name_Len := Name_Len - 1;
end if; end if;
...@@ -425,7 +424,10 @@ package body Uname is ...@@ -425,7 +424,10 @@ package body Uname is
-- Get_Unit_Name_String -- -- Get_Unit_Name_String --
-------------------------- --------------------------
procedure Get_Unit_Name_String (N : Unit_Name_Type) is procedure Get_Unit_Name_String
(N : Unit_Name_Type;
Suffix : Boolean := True)
is
Unit_Is_Body : Boolean; Unit_Is_Body : Boolean;
begin begin
...@@ -447,10 +449,12 @@ package body Uname is ...@@ -447,10 +449,12 @@ package body Uname is
-- Now adjust the %s or %b to (spec) or (body) -- Now adjust the %s or %b to (spec) or (body)
if Unit_Is_Body then if Suffix then
Name_Buffer (Name_Len - 1 .. Name_Len + 5) := " (body)"; if Unit_Is_Body then
else Name_Buffer (Name_Len - 1 .. Name_Len + 5) := " (body)";
Name_Buffer (Name_Len - 1 .. Name_Len + 5) := " (spec)"; else
Name_Buffer (Name_Len - 1 .. Name_Len + 5) := " (spec)";
end if;
end if; end if;
for J in 1 .. Name_Len loop for J in 1 .. Name_Len loop
...@@ -459,7 +463,13 @@ package body Uname is ...@@ -459,7 +463,13 @@ package body Uname is
end if; end if;
end loop; end loop;
Name_Len := Name_Len + (7 - 2); -- Adjust Name_Len
if Suffix then
Name_Len := Name_Len + (7 - 2);
else
Name_Len := Name_Len - 2;
end if;
end Get_Unit_Name_String; end Get_Unit_Name_String;
------------------ ------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet;
with Types; use Types; with Types; use Types;
package Uname is package Uname is
--------------------------- ---------------------------
...@@ -116,11 +118,14 @@ package Uname is ...@@ -116,11 +118,14 @@ package Uname is
-- N_Protected_Body_Stub -- N_Protected_Body_Stub
-- N_Subunit -- N_Subunit
procedure Get_Unit_Name_String (N : Unit_Name_Type); procedure Get_Unit_Name_String
-- Places the display name of the unit in Name_Buffer and sets Name_Len (N : Unit_Name_Type;
-- to the length of the stored name, i.e. it uses the same interface as Suffix : Boolean := True);
-- the Get_Name_String routine in the Namet package. The name contains -- Places the display name of the unit in Name_Buffer and sets Name_Len to
-- an indication of spec or body, and is decoded. -- the length of the stored name, i.e. it uses the same interface as the
-- Get_Name_String routine in the Namet package. The name is decoded and
-- contains an indication of spec or body if Boolean parameter Suffix is
-- True.
function Is_Body_Name (N : Unit_Name_Type) return Boolean; function Is_Body_Name (N : Unit_Name_Type) return Boolean;
-- Returns True iff the given name is the unit name of a body (i.e. if -- Returns True iff the given name is the unit name of a body (i.e. if
......
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