AdaCore / libadalang-tools

Libadalang-based tools
GNU General Public License v3.0
16 stars 13 forks source link

gnatpp: Projects with duplicate filenames cause Constraint_Error #6

Open LordAro opened 4 years ago

LordAro commented 4 years ago

With the following file structure:

foo/
    dir1/dummy.c
    dir2/dummy.c
    duplicatefile1.gpr
    duplicatefile2.gpr

With duplicatefile1.gpr & duplicatefile2.gpr looking like:

with "duplicatefile2";

project duplicatefile1 is
   for Library_Name use "test1";
   for Source_Dirs use ("dir1");
   for Languages use ("C");
end duplicatefile1;
project duplicatefile2 is
   for Library_Name use "test2";
   for Source_Dirs use ("dir2");
   for Languages use ("C");
end duplicatefile2;

gnatpp -Pduplicatefile1.gpr results in:

Unhandled Exception raised
raised CONSTRAINT_ERROR : Utils.String_Utilities.String_String_Maps.Insert: attempt to insert key already in map
[/home/cpigott/dev/libadalang-tools/bin/gnatpp]
Utils.String_Utilities.String_String_Maps.Insert at a-cohama.adb:680
Utils.Projects.Process_Project.Set_Individual_Source_Options at utils-projects.adb:1046
Utils.Projects.Process_Project at utils-projects.adb:1118
Utils.Projects.Process_Command_Line at utils-projects.adb:1399
Utils.Drivers.Driver at utils-drivers.adb:137
Pp.Main at pp-main.adb:20
Main at b__pp-main.adb:1706
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f25bfa48b95
[/home/cpigott/dev/libadalang-tools/bin/gnatpp]
0x407d78 _start at ???
0xfffffffffffffffe

Some debugging (-dc) indicates that it's only adding the filename to the map, not any information about the specific package it's coming from