[fpc-pascal]Re: Exit status of compiler on errors

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Dec 6 11:36:09 CET 2002


On Fri, 6 Dec 2002, Tom Verhoeff wrote:

>
> Tom Verhoeff wrote:
>
> >We use FreePascal in our education, and I am working on some scripts
> >that help teachers to develop programming assignments for students.
> >These assignments are then entered in PEACH (Programming Education
> >And Contest Hosting system: peach.win.tue.nl), which automatically
> >evaluates submitted programs and archives all results.
> >
> >It turns out that the FreePascal compiler also generates a 0 exit
> >status when there are (syntax) errors.  Is there any way in which
> >this can be changed?  My scripts would be considerably simpler if
> >the compiler generated a non-zero exit status when the compile is
> >not successful.
>
> I just discovered that invoking the compiler as  ppc386  does give
> a proper exit status, but when invoking it as  fpc  it does not.
> (Still under Linux.)
>
> Why is that?

'fpc' was later added. It does some checking of options, and then calls
ppc386 or ppcm68k or the powerpc version. Normally it should exit with
the same exit code as the executed binary, obviously, does doesn't
always happen.

>
> By the way, this is also relevant when calling the compiler from
> within make files.

The core developers never use fpc as far as I know. It's definitely a
bug.

I would not recommend using FPC in any case. It has been introduced
since it will replace the binary eventually when cross-compiling is more
fully supported.

>
> The gcc man page clearly explains the policy for its exit status.
> Maybe an idea for fpc (doc/manpage) as well.

I don't know whether there IS a clear 'policy' for the exit status
other than that the exit status is nonzero for an error. :-)

Michael.





More information about the fpc-pascal mailing list