2
0
Эх сурвалжийг харах

tests: ppus: test for bug 41291

mattias 2 долоо хоног өмнө
parent
commit
ef37f67749

+ 7 - 0
tests/tppu/bug41291/bug41291_app.pas

@@ -0,0 +1,7 @@
+program bug41291_app;
+
+uses
+  bug41291_mseclasses;
+
+begin
+end.

+ 13 - 0
tests/tppu/bug41291/bug41291_mclasses.pas

@@ -0,0 +1,13 @@
+unit bug41291_mclasses;
+
+interface
+
+type
+  TMyType = integer;
+
+implementation
+
+uses
+  bug41291_mseclasses;
+
+end.

+ 9 - 0
tests/tppu/bug41291/bug41291_mseapplication.pas

@@ -0,0 +1,9 @@
+unit bug41291_mseapplication;
+
+interface
+
+uses bug41291_mseclasses;
+
+implementation
+
+end.

+ 21 - 0
tests/tppu/bug41291/bug41291_mseclasses.pas

@@ -0,0 +1,21 @@
+unit bug41291_mseclasses;
+
+interface
+
+uses
+  bug41291_mclasses,
+  bug41291_mseifiglob;
+
+procedure alive(acomponent: TMyType);
+
+implementation
+
+uses
+  bug41291_mseapplication;
+
+procedure alive(acomponent: TMyType); inline;
+begin
+end;
+
+
+end.

+ 9 - 0
tests/tppu/bug41291/bug41291_mseeditglob.pas

@@ -0,0 +1,9 @@
+unit bug41291_mseeditglob;
+
+interface
+
+implementation
+
+uses bug41291_mseclasses;
+
+end.

+ 9 - 0
tests/tppu/bug41291/bug41291_mseifiglob.pas

@@ -0,0 +1,9 @@
+unit bug41291_mseifiglob;
+
+interface
+
+uses bug41291_mseeditglob;
+
+implementation
+
+end.

+ 1 - 0
tests/tppu/bug41291/ppus/.gitignore

@@ -0,0 +1 @@
+bug41291_app

+ 1 - 1
tests/tppu/implinline1/implinline1_bird.pas

@@ -10,7 +10,7 @@ implementation
 
 uses implinline1_ant;
 
-procedure Walk;
+procedure Walk; inline;
 begin
   writeln(Times123(2));
 end;

+ 18 - 0
tests/tppu/implinline2/implinline2_ant.pas

@@ -0,0 +1,18 @@
+unit implinline2_ant;
+
+{$mode objfpc}
+
+interface
+
+uses implinline2_bird;
+
+function Times123(w : word): word;
+
+implementation
+
+function Times123(w : word): word; inline;
+begin
+  Result := w*123;
+end;
+
+end.

+ 18 - 0
tests/tppu/implinline2/implinline2_bird.pas

@@ -0,0 +1,18 @@
+unit implinline2_bird;
+
+{$mode objfpc}
+
+interface
+
+procedure Walk;
+
+implementation
+
+uses implinline2_ant;
+
+procedure Walk; inline;
+begin
+  writeln(Times123(2));
+end;
+
+end.

+ 7 - 0
tests/tppu/implinline2/implinline2_prg.pas

@@ -0,0 +1,7 @@
+{$mode objfpc}
+
+uses implinline2_ant;
+
+begin
+  writeln(times123(2));
+end.

+ 1 - 0
tests/tppu/implinline2/ppus/.gitignore

@@ -0,0 +1 @@
+implinline2_prg

+ 45 - 1
tests/tppu/tcrecompile.pas

@@ -39,6 +39,8 @@ type
   published
     procedure TestTwoUnits;
     procedure TestImplInline1;
+    procedure TestImplInline2;
+    procedure TestImplInline_Bug41291;
   end;
 
 
@@ -216,10 +218,13 @@ begin
 
   Step:='Second compile';
   Compile;
+  // the bird ppu does not depend on ant, so it is kept
   CheckCompiled(['tppu_twounits_ant.pas']);
 end;
 
 procedure TTestRecompile.TestImplInline1;
+// unit ant uses bird
+// unit bird impl uses ant and has a function with inline modifier in implementation
 begin
   UnitPath:='implinline1';
   OutDir:='implinline1'+PathDelim+'ppus';
@@ -232,7 +237,46 @@ begin
 
   Step:='Second compile';
   Compile;
-  CheckCompiled(['implinline1_ant.pas']);
+  // the main src is always compiled, and since bird ppu depends on ant, it is always compiled as well
+  CheckCompiled(['implinline1_ant.pas','implinline1_bird.pas']);
+end;
+
+procedure TTestRecompile.TestImplInline2;
+// prg uses ant
+// unit ant uses bird
+// unit bird impl uses ant and has a function with inline modifier in implementation
+begin
+  UnitPath:='implinline2';
+  OutDir:='implinline2'+PathDelim+'ppus';
+  MainSrc:='implinline2'+PathDelim+'implinline2_prg.pas';
+
+  Step:='First compile';
+  CleanOutputDir;
+  Compile;
+  CheckCompiled(['implinline2_prg.pas','implinline2_ant.pas','implinline2_bird.pas']);
+
+  Step:='Second compile';
+  Compile;
+  // the main src is always compiled, the two ppus of ant and bird are kept
+  CheckCompiled(['implinline2_prg.pas']);
+end;
+
+procedure TTestRecompile.TestImplInline_Bug41291;
+begin
+  UnitPath:='bug41291';
+  OutDir:='bug41291'+PathDelim+'ppus';
+  MainSrc:='bug41291'+PathDelim+'bug41291_app.pas';
+
+  Step:='First compile';
+  CleanOutputDir;
+  Compile;
+  CheckCompiled(['bug41291_app.pas','bug41291_mclasses.pas','bug41291_mseapplication.pas',
+    'bug41291_mseclasses.pas','bug41291_mseeditglob.pas','bug41291_mseifiglob.pas']);
+
+  Step:='Second compile';
+  Compile;
+  // the main src is always compiled, the other ppus are kept
+  CheckCompiled(['bug41291_app.pas']);
 end;
 
 initialization