Commit 47edeeab by Arnaud Charlet

[multiple changes]

2010-06-22  Vincent Celier  <celier@adacore.com>

	* prj-nmsc.adb (Find_Sources): When a source from a multi-unit file is
	found, check if it's path has aready been found, whatever its index.

2010-06-22  Robert Dewar  <dewar@adacore.com>

	* atree.adb, gnatbind.adb: Minor reformatting.
	Minor code reorganization.

From-SVN: r161131
parent 6d812dd3
2010-06-22 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Find_Sources): When a source from a multi-unit file is
found, check if it's path has aready been found, whatever its index.
2010-06-22 Robert Dewar <dewar@adacore.com>
* atree.adb, gnatbind.adb: Minor reformatting.
Minor code reorganization.
2010-06-21 Robert Dewar <dewar@adacore.com> 2010-06-21 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Conditional_Expression): Fold if condition * exp_ch4.adb (Expand_N_Conditional_Expression): Fold if condition
......
...@@ -63,15 +63,15 @@ package body Atree is ...@@ -63,15 +63,15 @@ package body Atree is
-- Either way, gnat1 will stop when node 12345 is created -- Either way, gnat1 will stop when node 12345 is created
-- The second method is faster -- The second method is much faster
-- Similarly, rr and rrd allow breaking on rewriting of a given node. -- Similarly, rr and rrd allow breaking on rewriting of a given node
ww : Node_Id'Base := Node_Id'First - 1; ww : Node_Id'Base := Node_Id'First - 1;
pragma Export (Ada, ww); -- trick the optimizer pragma Export (Ada, ww); -- trick the optimizer
Watch_Node : Node_Id'Base renames ww; Watch_Node : Node_Id'Base renames ww;
-- Node to "watch"; that is, whenever a node is created, we check if it is -- Node to "watch"; that is, whenever a node is created, we check if it
-- equal to Watch_Node, and if so, call New_Node_Breakpoint. You have -- is equal to Watch_Node, and if so, call New_Node_Breakpoint. You have
-- presumably set a breakpoint on New_Node_Breakpoint. Note that the -- presumably set a breakpoint on New_Node_Breakpoint. Note that the
-- initial value of Node_Id'First - 1 ensures that by default, no node -- initial value of Node_Id'First - 1 ensures that by default, no node
-- will be equal to Watch_Node. -- will be equal to Watch_Node.
...@@ -108,7 +108,7 @@ package body Atree is ...@@ -108,7 +108,7 @@ package body Atree is
-- calls Rewrite_Breakpoint. Otherwise, does nothing. -- calls Rewrite_Breakpoint. Otherwise, does nothing.
procedure Node_Debug_Output (Op : String; N : Node_Id); procedure Node_Debug_Output (Op : String; N : Node_Id);
-- Common code for nnd and rrd. Write Op followed by information about N. -- Common code for nnd and rrd, writes Op followed by information about N
----------------------------- -----------------------------
-- Local Objects and Types -- -- Local Objects and Types --
......
...@@ -826,7 +826,7 @@ begin ...@@ -826,7 +826,7 @@ begin
-- sources) if -R was used. -- sources) if -R was used.
if List_Closure then if List_Closure then
declare List_Closure_Display : declare
Source : File_Name_Type; Source : File_Name_Type;
function Put_In_Sources (S : File_Name_Type) return Boolean; function Put_In_Sources (S : File_Name_Type) return Boolean;
...@@ -852,6 +852,8 @@ begin ...@@ -852,6 +852,8 @@ begin
return True; return True;
end Put_In_Sources; end Put_In_Sources;
-- Start of processing for List_Closure_Display
begin begin
Closure_Sources.Init; Closure_Sources.Init;
...@@ -862,7 +864,6 @@ begin ...@@ -862,7 +864,6 @@ begin
end if; end if;
for J in reverse Elab_Order.First .. Elab_Order.Last loop for J in reverse Elab_Order.First .. Elab_Order.Last loop
Source := Units.Table (Elab_Order.Table (J)).Sfile; Source := Units.Table (Elab_Order.Table (J)).Sfile;
-- Do not include the sources of the runtime and do not -- Do not include the sources of the runtime and do not
...@@ -875,7 +876,7 @@ begin ...@@ -875,7 +876,7 @@ begin
Write_Str (" "); Write_Str (" ");
end if; end if;
Write_Str (Get_Name_String (Source)); Write_Str (Get_Name_String (Source));
Write_Eol; Write_Eol;
end if; end if;
end loop; end loop;
...@@ -908,7 +909,7 @@ begin ...@@ -908,7 +909,7 @@ begin
if not Zero_Formatting then if not Zero_Formatting then
Write_Eol; Write_Eol;
end if; end if;
end; end List_Closure_Display;
end if; end if;
end if; end if;
end if; end if;
......
...@@ -57,8 +57,14 @@ package body Prj.Nmsc is ...@@ -57,8 +57,14 @@ package body Prj.Nmsc is
Listed : Boolean := False; Listed : Boolean := False;
Found : Boolean := False; Found : Boolean := False;
end record; end record;
No_Name_Location : constant Name_Location := No_Name_Location : constant Name_Location :=
(No_File, No_Location, No_Source, False, False); (Name => No_File,
Location => No_Location,
Source => No_Source,
Listed => False,
Found => False);
package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable package Source_Names_Htable is new GNAT.Dynamic_HTables.Simple_HTable
(Header_Num => Header_Num, (Header_Num => Header_Num,
Element => Name_Location, Element => Name_Location,
...@@ -66,11 +72,10 @@ package body Prj.Nmsc is ...@@ -66,11 +72,10 @@ package body Prj.Nmsc is
Key => File_Name_Type, Key => File_Name_Type,
Hash => Hash, Hash => Hash,
Equal => "="); Equal => "=");
-- Information about file names found in string list attribute -- File name information found in string list attribute (Source_Files or
-- (Source_Files or Source_List_File). -- Source_List_File). Except is set to True if source is a naming exception
-- Except is set to True if source is a naming exception in the project. -- in the project. Used to check that all referenced files were indeed
-- This is used to check that all referenced files were indeed found on the -- found on the disk.
-- disk.
type Unit_Exception is record type Unit_Exception is record
Name : Name_Id; -- ??? duplicates the key Name : Name_Id; -- ??? duplicates the key
...@@ -6405,6 +6410,8 @@ package body Prj.Nmsc is ...@@ -6405,6 +6410,8 @@ package body Prj.Nmsc is
declare declare
Source : Source_Id; Source : Source_Id;
Iter : Source_Iterator; Iter : Source_Iterator;
Found : Boolean := False;
Path : Path_Information;
begin begin
Iter := For_Each_Source (Data.Tree, Project.Project); Iter := For_Each_Source (Data.Tree, Project.Project);
...@@ -6416,16 +6423,22 @@ package body Prj.Nmsc is ...@@ -6416,16 +6423,22 @@ package body Prj.Nmsc is
and then Source.Path = No_Path_Information and then Source.Path = No_Path_Information
then then
if Source.Unit /= No_Unit_Index then if Source.Unit /= No_Unit_Index then
Found := False;
-- For multi-unit source files, source_id gets duplicated -- For multi-unit source files, source_id gets duplicated
-- once for every unit. Only the first source_id got its -- once for every unit. Only the first source_id got its
-- full path set. So if it isn't set for that first one, -- full path set.
-- the file wasn't found. Otherwise we need to update for
-- units after the first one.
if Source.Index = 0 if Source.Index /= 0 then
or else Source.Index = 1 Path := Files_Htable.Get
then (Data.File_To_Source, Source.File).Path;
if Path /= No_Path_Information then
Found := True;
end if;
end if;
if not Found then
Error_Msg_Name_1 := Name_Id (Source.Display_File); Error_Msg_Name_1 := Name_Id (Source.Display_File);
Error_Msg_Name_2 := Name_Id (Source.Unit.Name); Error_Msg_Name_2 := Name_Id (Source.Unit.Name);
Error_Msg Error_Msg
...@@ -6434,8 +6447,7 @@ package body Prj.Nmsc is ...@@ -6434,8 +6447,7 @@ package body Prj.Nmsc is
No_Location, Project.Project); No_Location, Project.Project);
else else
Source.Path := Files_Htable.Get Source.Path := Path;
(Data.File_To_Source, Source.File).Path;
if Current_Verbosity = High then if Current_Verbosity = High then
if Source.Path /= No_Path_Information then if Source.Path /= No_Path_Information then
...@@ -6443,7 +6455,7 @@ package body Prj.Nmsc is ...@@ -6443,7 +6455,7 @@ package body Prj.Nmsc is
& Get_Name_String (Source.File) & Get_Name_String (Source.File)
& " at" & Source.Index'Img & " at" & Source.Index'Img
& " to " & " to "
& Get_Name_String (Source.Path.Name)); & Get_Name_String (Path.Name));
end if; end if;
end if; end if;
end if; end 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