[Ada] All duplicate units in a project now reported
Arnaud Charlet
charlet@adacore.com
Fri Oct 8 10:51:00 GMT 2010
If there are several duplicate units in a project, they are all reported once.
The test for this is to invoke gnatmake on a project with duplicate units "a"
and "b" in the same source directory subtree (".../**"). Both duplicate units
"a" and "b" should be reported.
Tested on x86_64-pc-linux-gnu, committed on trunk
2010-10-08 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Add_Source): Report all duplicate units and source file
names. Do not report the same duplicate unit several times.
* prj.ads (Source_Data): New Boolean component Duplicate_Unit,
defaulted to False, to avoid reporting the same unit as duplicate
several times.
-------------- next part --------------
Index: prj.ads
===================================================================
--- prj.ads (revision 165084)
+++ prj.ads (working copy)
@@ -765,6 +765,9 @@ package Prj is
Naming_Exception : Boolean := False;
-- True if the source has an exceptional name
+ Duplicate_Unit : Boolean := False;
+ -- True when a duplicate unit has been reported for this source
+
Next_In_Lang : Source_Id := No_Source;
-- Link to another source of the same language in the same project
end record;
@@ -799,6 +802,7 @@ package Prj is
Switches_Path => No_Path,
Switches_TS => Empty_Time_Stamp,
Naming_Exception => False,
+ Duplicate_Unit => False,
Next_In_Lang => No_Source);
package Source_Paths_Htable is new Simple_HTable
Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb (revision 165152)
+++ prj-nmsc.adb (working copy)
@@ -705,9 +705,13 @@ package body Prj.Nmsc is
-- (for instance because of symbolic links).
elsif Source.Path.Name /= Path.Name then
- Error_Msg_Name_1 := Unit;
- Error_Msg
- (Data.Flags, "duplicate unit %%", Location, Project);
+ if not Source.Duplicate_Unit then
+ Error_Msg_Name_1 := Unit;
+ Error_Msg
+ (Data.Flags, "\duplicate unit %%", Location, Project);
+ Source.Duplicate_Unit := True;
+ end if;
+
Add_Src := False;
end if;
end if;
More information about the Gcc-patches
mailing list