Marius Gedminas wrote:
- (I think this one is not new) `--automake' does pass all required .o files to the linker if it didn't need to recompile the sources.
That's not new, but again a better analysis of the problem. In order to hunt the bug, an example program which will output "OK" when the bug will be fixed would be helpful. (Or do we already have one? I have lost overview a little ... #-)
I never had it (overview, that is), but I do not think it is easy to write such a program. Well, maybe...
Well, it was almost perfect! :-)
First time it compiles nicely, second time ld complains about `Callsecond' being undefined. It might be possible to write a wrapper to execute `gpc --automake automakebug.pas' twice and output 'Ok' if the second compilation succeeds.
The test suite currently doesn't support this, but I think it's easy to achieve by just putting two copies of the main program into the test suite. This would look like the following (I just renamed the files and changed the output string):
--- marius2.pas AND marius2c.pas:
program Marius2;
{ This tests a bug in the automake mechanism. When the first program (marius2.pas) is compiled, it works well, but when the seconds program (marius2c.pas, identical to marius2.pas!) is compiled, and the pre-compiled units are already there, it fails. -- Just in case anyone wonders why there are two identical files in the test suite... }
uses Marius2a;
begin CallFirst; end.
--- marius2a.pas:
unit Marius2a;
interface
procedure CallFirst;
implementation
uses Marius2b;
procedure CallFirst; begin CallSecond; end;
end.
--- marius2b.pas:
unit Marius2b;
interface
procedure CallSecond;
implementation
procedure CallSecond; begin WriteLn('OK'); end;
end.
---
When I run it through the test suite, it gives "OK" for marius2.pas and an error for marius2c.pas.