* Moved multiple similar checks for FPC_HAS_FEATURE_EXITCODE and FPC_LIMITED_EXITCODE to Halt() procedure. Now these checks appear only once.

git-svn-id: trunk@19597 -
This commit is contained in:
sergei 2011-11-05 16:48:12 +00:00
parent 56900b4754
commit ebe1d74d6e
2 changed files with 11 additions and 32 deletions

View File

@ -159,12 +159,7 @@ begin
if erroraddr = nil then
RunError(217)
else
{$ifdef FPC_LIMITED_EXITCODE}
if errorcode > maxExitCode then
halt(255)
else
{$endif FPC_LIMITED_EXITCODE}
halt(errorcode);
Halt(errorcode);
end;

View File

@ -939,7 +939,14 @@ end;
Procedure Halt(ErrNum: Longint);
Begin
ExitCode:=Errnum;
{$ifdef FPC_HAS_FEATURE_EXITCODE}
{$ifdef FPC_LIMITED_EXITCODE}
if ErrNum > maxExitCode then
ExitCode:=255
else
{$endif FPC_LIMITED_EXITCODE}
ExitCode:=ErrNum;
{$endif FPC_HAS_FEATURE_EXITCODE}
Do_Exit;
end;
@ -961,17 +968,7 @@ begin
if ExceptAddrStack <> nil then
raise TObject(nil) at addr,frame;
{$endif FPC_HAS_FEATURE_EXCEPTIONS}
{$ifdef FPC_HAS_FEATURE_EXITCODE}
{$ifdef FPC_LIMITED_EXITCODE}
if errorcode > maxExitCode then
halt(255)
else
{$endif FPC_LIMITED_EXITCODE}
halt(errorcode);
{$else FPC_HAS_FEATURE_EXITCODE}
halt;
{$endif FPC_HAS_FEATURE_EXITCODE}
Halt(errorcode);
end;
Procedure HandleErrorFrame (Errno : longint;frame : Pointer);
@ -1000,16 +997,7 @@ begin
errorcode:=w;
erroraddr:=get_caller_addr(get_frame);
errorbase:=get_caller_frame(get_frame);
{$ifdef FPC_HAS_FEATURE_EXITCODE}
{$ifdef FPC_LIMITED_EXITCODE}
if errorcode > maxExitCode then
halt(255)
else
{$endif FPC_LIMITED_EXITCODE}
halt(errorcode);
{$else FPC_HAS_FEATURE_EXITCODE}
halt;
{$endif FPC_HAS_FEATURE_EXITCODE}
Halt(errorcode);
end;
@ -1269,11 +1257,7 @@ begin
write(stderr,msg);
Writeln(stderr,' (',FName,', line ',LineNo,').');
Writeln(stderr,'');
{$ifdef FPC_HAS_FEATURE_EXITCODE}
Halt(227);
{$else FPC_HAS_FEATURE_EXITCODE}
halt;
{$endif FPC_HAS_FEATURE_EXITCODE}
{$endif FPC_HAS_FEATURE_CONSOLEIO}
end;