From 1bf58c2a55dfb16d6b000ff62812eae3002614c7 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 1 Oct 2020 20:33:02 +0000 Subject: [PATCH] + introduce TExitCode git-svn-id: trunk@47029 - --- rtl/inc/compproc.inc | 2 +- rtl/inc/system.inc | 18 +++++++++--------- rtl/inc/systemh.inc | 8 ++++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/rtl/inc/compproc.inc b/rtl/inc/compproc.inc index 05a3507c26..a903868457 100644 --- a/rtl/inc/compproc.inc +++ b/rtl/inc/compproc.inc @@ -797,7 +797,7 @@ Procedure fpc_do_exit; compilerproc; Procedure fpc_HandleErrorAddrFrame (Errno : longint;addr,frame : pointer); compilerproc; } Procedure fpc_lib_exit; compilerproc; -Procedure fpc_HandleError (Errno : longint); compilerproc; +Procedure fpc_HandleError (Errno : TExitCode); compilerproc; procedure fpc_AbstractErrorIntern;compilerproc; procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint;ErrorAddr:Pointer); compilerproc; diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 8d62520a80..6a0dc0b3c7 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -33,10 +33,10 @@ type {$endif} {$endif FPC_HAS_FEATURE_EXITCODE} -Procedure HandleError (Errno : Longint); external name 'FPC_HANDLEERROR'; -Procedure HandleErrorFrame (Errno : longint;frame : Pointer); forward; -Procedure HandleErrorAddrFrame (Errno : longint;addr : CodePointer; frame : Pointer); forward; -Procedure HandleErrorAddrFrameInd (Errno : longint;addr : CodePointer; frame : Pointer); forward; +Procedure HandleError (Errno : TExitCode); external name 'FPC_HANDLEERROR'; +Procedure HandleErrorFrame (Errno : TExitCode;frame : Pointer); forward; +Procedure HandleErrorAddrFrame (Errno : TExitCode;addr : CodePointer; frame : Pointer); forward; +Procedure HandleErrorAddrFrameInd (Errno : TExitCode;addr : CodePointer; frame : Pointer); forward; {$ifdef FPC_HAS_FEATURE_TEXTIO} type @@ -1268,7 +1268,7 @@ begin end; -Procedure Halt(ErrNum: Longint);noreturn; +Procedure Halt(ErrNum: TExitCode);noreturn; Begin {$ifdef FPC_HAS_FEATURE_EXITCODE} {$ifdef FPC_LIMITED_EXITCODE} @@ -1320,7 +1320,7 @@ end; {$endif FPC_SYSTEM_HAS_CAPTUREBACKTRACE} -Procedure HandleErrorAddrFrame (Errno : longint;addr : CodePointer; frame : Pointer);[public,alias:'FPC_BREAK_ERROR']; {$ifdef CPUI386} register; {$endif} +Procedure HandleErrorAddrFrame (Errno : TExitCode;addr : CodePointer; frame : Pointer);[public,alias:'FPC_BREAK_ERROR']; {$ifdef CPUI386} register; {$endif} begin If codepointer(ErrorProc)<>Nil then ErrorProc(Errno,addr,frame); @@ -1337,13 +1337,13 @@ end; { This is used internally by system skip first level, and generated the same output as before, when HandleErrorFrame function was used internally. } -Procedure HandleErrorAddrFrameInd (Errno : longint;addr : CodePointer; frame : Pointer); +Procedure HandleErrorAddrFrameInd (Errno : TExitCode;addr : CodePointer; frame : Pointer); begin get_caller_stackinfo (frame, addr); HandleErrorAddrFrame (Errno,addr,frame); end; -Procedure HandleErrorFrame (Errno : longint;frame : Pointer); +Procedure HandleErrorFrame (Errno : TExitCode;frame : Pointer); { Procedure to handle internal errors, i.e. not user-invoked errors Internal function should ALWAYS call HandleError instead of RunError. @@ -1354,7 +1354,7 @@ begin end; -procedure fpc_handleerror (Errno : longint); compilerproc; [public,alias : 'FPC_HANDLEERROR']; +procedure fpc_handleerror (Errno : TExitCode); compilerproc; [public,alias : 'FPC_HANDLEERROR']; { Procedure to handle internal errors, i.e. not user-invoked errors Internal function should ALWAYS call HandleError instead of RunError. diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index 3a8b3a29ca..618d47fed1 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -403,6 +403,7 @@ Type CodePointer = Pointer; CodePtrInt = PtrInt; CodePtrUInt = PtrUInt; + TExitCode = Longint; {$endif CPU64} {$ifdef CPU32} @@ -415,6 +416,7 @@ Type CodePointer = Pointer; CodePtrInt = PtrInt; CodePtrUInt = PtrUInt; + TExitCode = Longint; {$endif CPU32} {$ifdef CPU16} @@ -446,6 +448,8 @@ Type {$endif} ValSInt = Integer; ValUInt = Word; + { this is TP compatible } + TExitCode = Word; {$endif CPU16} {$if defined(VER2) or defined(VER3_0)} @@ -774,7 +778,7 @@ const ModuleIsCpp : Boolean = FALSE; var - ExitCode : Longint; public name 'operatingsystem_result'; + ExitCode : TExitCode; public name 'operatingsystem_result'; RandSeed : Cardinal; { Delphi compatibility } @@ -1604,7 +1608,7 @@ procedure DumpExceptionBacktrace(var f:text); Procedure RunError(w:Word);noreturn; Procedure RunError;{$ifdef SYSTEMINLINE}inline;{$endif}noreturn; -Procedure Halt(errnum:Longint);noreturn; +Procedure Halt(errnum:TExitCode);noreturn; {$ifdef FPC_HAS_FEATURE_HEAP} Procedure AddExitProc(Proc:TProcedure); {$endif FPC_HAS_FEATURE_HEAP}