The -vb option does not affect end-of-file fatal errors
Summary
When using the -vb option (display full file paths when printing diagnostic messages), fatal errors encountered at end of file are not affected.
System Information
- Operating system: Linux (Fedora 34)
- Processor architecture: x86_64
- Compiler version: stable 3.2.2 / development 10fcae34
- Device: Computer
Steps to reproduce
Compile a program that features errors (but not fatal errors), or has an unexpected end-of-file, while using the -vb option.
Example Project
program infinite;
begin
writeln('Oh no, forgot to "End." the program!');
Program error;
Function SomeFunc(Param: Integer):Integer;
Begin
Exit((Param * 5) div 2)
End;
Begin
Writeln('The result of SomeFunc is: ', SomeFunc())
End.
program fatal;
begin
Writeln('Oh no, syntax error!', );
end.
What is the current bug behavior?
Compiling the infinite program gives the following compiler messages:
Compiling /fpc/bug-tests/infinite.pas
infinite.pas(4) Fatal: Unexpected end of file
Compiling the error program gives the following compiler messages:
Compiling /fpc/bug-tests/error.pas
/fpc/bug-tests/error.pas(9,41) Error: Wrong number of parameters specified for call to "SomeFunc"
/fpc/bug-tests/error.pas(3,10) Error: Found declaration: SomeFunc(SmallInt):SmallInt;
error.pas(11) Fatal: There were 2 errors compiling module, stopping
Note how, in both cases, the "Fatal" message at the end prints out only the base name of the file.
Interestingly, this does not occur with the fatal program:
Compiling /fpc/bug-tests/fatal.pas
/fpc/bug-tests/fatal.pas(3,34) Error: Illegal expression
/fpc/bug-tests/fatal.pas(3,35) Fatal: Syntax error, ")" expected but ";" found
What is the expected (correct) behavior?
All fatal errors respect the -vb flag, i.e. compiling the infinite program would print:
/fpc/bug-tests/infinite.pas(4) Fatal: Unexpected end of file
and compiling the error program would print:
/fpc/bug-tests/error.pas(11) Fatal: There were 2 errors compiling module, stopping