Преглед на файлове

* 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 -

svenbarth преди 4 години
родител
ревизия
924f9466f0
променени са 4 файла, в които са добавени 56 реда и са изтрити 10 реда
  1. 2 0
      .gitattributes
  2. 20 10
      compiler/fppu.pas
  3. 17 0
      tests/webtbs/tw26760.pp
  4. 17 0
      tests/webtbs/uw26760/uw26760.pp

+ 2 - 0
.gitattributes

@@ -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

+ 20 - 10
compiler/fppu.pas

@@ -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 sourcefn<>'' then
+                    Source_Time:=GetNamedFileTime(sourcefn)
+                  else
+                    Source_Time:=-1;
                   if Source_Time<>-1 then
-                    hs:=path+hs
+                    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 - 0
tests/webtbs/tw26760.pp

@@ -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.
+

+ 17 - 0
tests/webtbs/uw26760/uw26760.pp

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