File tree Expand file tree Collapse file tree 9 files changed +77
-0
lines changed
testsuite/tests/projects/custom_name_duplicate Expand file tree Collapse file tree 9 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -9901,6 +9901,15 @@ package body GNATCOLL.Projects is
99019901 Source := Element (Source_Iter);
99029902 exit when Source = No_Source;
99039903
9904+ if Source.Replaced_By /= No_Source then
9905+ -- In case of extending project inheriting package Naming of
9906+ -- the extended one and source dirs of both projects containing
9907+ -- same naming exception source, we will get a duplicate base
9908+ -- name outside of aggregate project here which is not allowed.
9909+ -- The replaced source needs to be ignored.
9910+ goto Next_Source;
9911+ end if ;
9912+
99049913 -- Get the absolute path name for this source
99059914
99069915 Get_Name_String (Source.Path.Display_Name);
@@ -10009,6 +10018,7 @@ package body GNATCOLL.Projects is
1000910018 end if ;
1001010019 end ;
1001110020
10021+ <<Next_Source>>
1001210022 Next (Source_Iter);
1001310023 end loop ;
1001410024
Original file line number Diff line number Diff line change 1+ project P extends "q/q.gpr" is
2+ end P;
Original file line number Diff line number Diff line change 1+ package Pack is
2+ end Pack;
Original file line number Diff line number Diff line change 1+ package Pack2 is
2+ end Pack2 ;
Original file line number Diff line number Diff line change 1+ package Pack is
2+ end Pack;
Original file line number Diff line number Diff line change 1+ package Pack2 is
2+ end Pack2 ;
Original file line number Diff line number Diff line change 1+ project Q is
2+ package Naming is
3+ for Spec ("Pack") use "pack.ads_foo";
4+ end Naming;
5+ end Q;
Original file line number Diff line number Diff line change 1+ with GNATCOLL.Projects ; use GNATCOLL.Projects;
2+ with GNATCOLL.Projects.Aux ;
3+ with GNATCOLL.VFS ; use GNATCOLL.VFS;
4+ with Test_Assert ;
5+
6+ with Ada.Containers.Indefinite_Ordered_Sets ;
7+
8+ function Test return Integer is
9+ PT : Project_Tree;
10+ Env : Project_Environment_Access;
11+
12+ Files : File_Array_Access;
13+
14+ package Sets is new Ada.Containers.Indefinite_Ordered_Sets (String);
15+ use Sets;
16+
17+ Set : Sets.Set;
18+ begin
19+ Initialize (Env);
20+ PT.Load (GNATCOLL.VFS.Create (" p.gpr" ), Env);
21+
22+ Files := PT.Root_Project.Source_Files (Recursive => True);
23+
24+ for F of Files.all loop
25+ if Set.Contains (F.Display_Base_Name) then
26+ Test_Assert.Assert
27+ (False, " duplicating source: " & F.Display_Base_Name);
28+ else
29+ Set.Insert (F.Display_Base_Name);
30+ end if ;
31+ end loop ;
32+
33+ Unchecked_Free (Files);
34+
35+ Set.Clear;
36+ GNATCOLL.Projects.Aux.Delete_All_Temp_Files (PT.Root_Project);
37+ Unload (PT);
38+ Free (Env);
39+
40+ return Test_Assert.Report;
41+ end Test ;
Original file line number Diff line number Diff line change 1+ description : >
2+ Check that when extending project has no package Naming
3+ but extended one does and source dirs of both projects
4+ have the same naming exception source Source_Files returns
5+ only one of those sources and not both.
6+ data :
7+ - " test.adb"
8+ - " p.gpr"
9+ - " pack.ads_foo"
10+ - " pack2.ads"
11+ - " q"
You can’t perform that action at this time.
0 commit comments