Browse Source

* Workaround dead code warnings by using preprocessor.

git-svn-id: trunk@9497 -
yury 17 năm trước cách đây
mục cha
commit
99ea98c7b1
2 tập tin đã thay đổi với 21 bổ sung9 xóa
  1. 5 3
      rtl/inc/except.inc
  2. 16 6
      rtl/inc/system.inc

+ 5 - 3
rtl/inc/except.inc

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

+ 16 - 6
rtl/inc/system.inc

@@ -12,6 +12,12 @@
 
  **********************************************************************}
 
+{$ifdef FPC_OBJFPC_EXTENDED_IF}
+  {$if High(errorcode)<>maxExitCode}
+    {$define FPC_LIMITED_EXITCODE}
+  {$endif}
+{$endif FPC_OBJFPC_EXTENDED_IF}
+
 {****************************************************************************
                                 Local types
 ****************************************************************************}
@@ -867,10 +873,12 @@ begin
 {$endif FPC_HAS_FEATURE_EXCEPTIONS}
 
 {$ifdef FPC_HAS_FEATURE_EXITCODE}
-  if errorcode <= maxExitCode then
-    halt(errorcode)
-  else
+{$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}
@@ -903,10 +911,12 @@ begin
   erroraddr:=get_caller_addr(get_frame);
   errorbase:=get_caller_frame(get_frame);
 {$ifdef FPC_HAS_FEATURE_EXITCODE}
-  if errorcode <= maxExitCode then
-    halt(errorcode)
-  else
+{$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}