From 11f673a991cda195d361f355d3f2aeb0165e71d9 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Sun, 6 May 2018 21:16:51 +0000 Subject: [PATCH] * also allow a ";"-separated list of namespaces for -FN + added test git-svn-id: trunk@38939 - --- .gitattributes | 1 + compiler/options.pas | 28 ++++++++++++++++++++++++++-- tests/test/tudots6.pp | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/test/tudots6.pp diff --git a/.gitattributes b/.gitattributes index a899d2f78a..5978fe1393 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13735,6 +13735,7 @@ tests/test/tudots2.pp svneol=native#text/pascal tests/test/tudots3.pp svneol=native#text/pascal tests/test/tudots4.pp svneol=native#text/pascal tests/test/tudots5.pp svneol=native#text/pascal +tests/test/tudots6.pp svneol=native#text/pascal tests/test/tuglylabels1.pp svneol=native#text/plain tests/test/tunaligned1.pp svneol=native#text/plain tests/test/tunistr1.pp svneol=native#text/plain diff --git a/compiler/options.pas b/compiler/options.pas index 34a9ea1b77..5c1e2a0fff 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -3629,7 +3629,10 @@ var i : tfeature; j : longint; abi : tabi; - cmditem: TCmdStrListItem; + tmplist : TCmdStrList; + cmditem, + tmpcmditem : TCmdStrListItem; + cmdstr : TCmdStr; {$if defined(cpucapabilities)} cpuflag : tcpuflags; hs : string; @@ -3838,12 +3841,33 @@ begin add_package(option.parapackages.NameOfIndex(j),true,true); { add default namespaces } + tmplist:=TCmdStrList.Create; cmditem:=TCmdStrListItem(option.paranamespaces.First); while assigned(cmditem) do begin - namespacelist.insert(cmditem.Str); + { use a temporary list cause if ";" are involved we need to reverse the + order due to how TCmdStrList behaves } + cmdstr:=cmditem.str; + repeat + j:=Pos(';',cmdstr); + if j>0 then + begin + tmplist.insert(copy(cmdstr,1,j-1)); + delete(cmdstr,1,j); + end + else + tmplist.insert(cmdstr); + until j=0; + tmpcmditem:=TCmdStrListItem(tmplist.First); + while assigned(tmpcmditem) do + begin + namespacelist.insert(tmpcmditem.Str); + tmpcmditem:=TCmdStrListItem(tmpcmditem.Next); + end; + tmplist.clear; cmditem:=TCmdStrListItem(cmditem.Next); end; + tmplist.Free; { add unit environment and exepath to the unit search path } if inputfilepath<>'' then diff --git a/tests/test/tudots6.pp b/tests/test/tudots6.pp new file mode 100644 index 0000000000..25370e37e1 --- /dev/null +++ b/tests/test/tudots6.pp @@ -0,0 +1,17 @@ +{ %OPT="-FNudots;udots.udots" } + +program tudots6; + +uses + Unit1, { finds UDots.Unit1 in udots.unit.pp } + Unit5; { finds UDots.UDots.Unit5 in udots.udots.unit5.pp } + +begin + if Unit1Str <> 'UDots.Unit1' then + Halt(1); + if Unit5Str <> 'UDots.UDots.Unit5' then + Halt(2); + + Writeln('ok'); +end. +