* fix for Mantis #26760: apply patch by Ondrej Pokorny to ensure that units referenced by an "in"-clause are recompiled when they have been changed

+ added test (though due to the nature of the bug it needs to be interactive)

git-svn-id: trunk@49587 -
This commit is contained in:
svenbarth 2021-07-09 15:52:00 +00:00
parent cb0f422eb1
commit 924f9466f0
4 changed files with 57 additions and 11 deletions

2
.gitattributes vendored
View File

@ -18134,6 +18134,7 @@ tests/webtbs/tw2668.pp svneol=native#text/plain
tests/webtbs/tw2669.pp svneol=native#text/plain
tests/webtbs/tw26749.pp svneol=native#text/pascal
tests/webtbs/tw2676.pp svneol=native#text/plain
tests/webtbs/tw26760.pp svneol=native#text/pascal
tests/webtbs/tw26773.pp svneol=native#text/plain
tests/webtbs/tw2678.pp svneol=native#text/plain
tests/webtbs/tw26791.pp svneol=native#text/pascal
@ -19366,6 +19367,7 @@ tests/webtbs/uw25598.pp svneol=native#text/plain
tests/webtbs/uw25610a.pp -text svneol=native#text/plain
tests/webtbs/uw25610b.pp -text svneol=native#text/plain
tests/webtbs/uw25814.pp svneol=native#text/plain
tests/webtbs/uw26760/uw26760.pp svneol=native#text/pascal
tests/webtbs/uw26922a.pp svneol=native#text/pascal
tests/webtbs/uw26922b.pp svneol=native#text/pascal
tests/webtbs/uw2706a.pp svneol=native#text/plain

View File

@ -538,7 +538,7 @@ var
var
fnd : boolean;
hs : TPathStr;
hs : TPathStr;
nsitem : TCmdStrListItem;
begin
if shortname then
@ -1129,20 +1129,30 @@ var
else
begin
{ check the date of the source files:
1 path of ppu
2 path of main source
3 current dir
4 include/unit path }
Source_Time:=GetNamedFileTime(path+hs);
1 path of sourcefn
2 path of ppu
3 path of main source
4 current dir
5 include/unit path }
found:=false;
if Source_Time<>-1 then
hs:=path+hs
if sourcefn<>'' then
Source_Time:=GetNamedFileTime(sourcefn)
else
Source_Time:=-1;
if Source_Time<>-1 then
hs:=sourcefn
else
if not(is_main) then
begin
Source_Time:=GetNamedFileTime(main_dir+hs);
Source_Time:=GetNamedFileTime(path+hs);
if Source_Time<>-1 then
hs:=main_dir+hs;
hs:=path+hs
else
if not(is_main) then
begin
Source_Time:=GetNamedFileTime(main_dir+hs);
if Source_Time<>-1 then
hs:=main_dir+hs;
end;
end;
if Source_Time=-1 then
Source_Time:=GetNamedFileTime(hs);

17
tests/webtbs/tw26760.pp Normal file
View File

@ -0,0 +1,17 @@
{ %INTERACTIVE }
{ Note: to test this, first compile this program, then change something inside
unit uw26760 and make sure that it's recompiled (e.g. either by checking
the compiler messages or by introducing a compile error) }
program tw26760;
{$mode objfpc}{$H+}
uses
uw26760 in 'uw26760/uw26760.pp';
begin
Test;
end.

View File

@ -0,0 +1,17 @@
unit uw26760;
{$mode objfpc}{$H+}
interface
procedure Test;
implementation
procedure Test;
begin
Writeln('test'); a
end;
end.