Browse Source

* further fix for Mants #26760: applied patch by Ondrej Pokorny to fix recompilation of units referenced with an "in" clause if no file extension is provided
+ added (interactive) test

git-svn-id: trunk@49613 -

svenbarth 4 years ago
parent
commit
2a2576b1d5
3 changed files with 28 additions and 5 deletions
  1. 1 0
      .gitattributes
  2. 7 5
      compiler/fppu.pas
  3. 20 0
      tests/webtbs/tw26760b.pp

+ 1 - 0
.gitattributes

@@ -18143,6 +18143,7 @@ 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/tw26760b.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

+ 7 - 5
compiler/fppu.pas

@@ -1136,12 +1136,14 @@ var
                      5 include/unit path }
                   found:=false;
                   if sourcefn<>'' then
-                    Source_Time:=GetNamedFileTime(sourcefn)
-                  else
+                  begin
+                    temp_dir:=ExtractFilePath(SetDirSeparators(sourcefn));
+                    Source_Time:=GetNamedFileTime(temp_dir+hs);
+                    if Source_Time<>-1 then
+                      hs:=temp_dir+hs;
+                  end else
                     Source_Time:=-1;
-                  if Source_Time<>-1 then
-                    hs:=sourcefn
-                  else
+                  if Source_Time=-1 then
                     begin
                       Source_Time:=GetNamedFileTime(path+hs);
                       if Source_Time<>-1 then

+ 20 - 0
tests/webtbs/tw26760b.pp

@@ -0,0 +1,20 @@
+{ %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).
+        Make sure you use the -FUlib compiler option so that the PPU is
+        created into a separate directory (otherwise the PP file is found next
+        to the PPU file. }
+
+program tw26760;
+
+{$mode objfpc}{$H+}
+
+uses
+  uw26760 in 'uw26760/uw26760';
+
+begin
+  Test;
+end.
+