[fpc-devel] Conditional define for FPC_LIMITEDEXITCODE

Sven Barth svenmauren at vr-web.de
Wed Nov 18 21:08:41 CET 2009


Hello together!

I'm currently trying to silence some compiler warnings in the Native NT 
RTL and one of these is "unreachable code" in e. g. rtl/inc/except.inc 
line 180. It seems as if FPC_LIMITEDEXITCODE is defined although that is 
not my intention. As ExitCode is defined as LongInt on Native NT and I 
didn't found any restrictions for that, I simply defined maxExitCode as 
High(LongInt) in my system.pp, hoping I'd disable any 
FPC_LIMITEDEXITCODE defines.

FPC_LIMITEDEXITCODE is defined around line 28 in system.inc in the 
following way:

{$ifdef FPC_HAS_FEATURE_EXITCODE}
   {$ifdef FPC_OBJFPC_EXTENDED_IF}
     {$if High(errorcode)<>maxExitCode}
       {$define FPC_LIMITED_EXITCODE}
     {$endif}
   {$else}
     {$define FPC_LIMITED_EXITCODE}
   {$endif FPC_OBJFPC_EXTENDED_IF}
{$endif FPC_HAS_FEATURE_EXITCODE}

I understand why maxExitCode is compared with High, but why is errorcode 
used in that High? errorcode is defined as Word, while ExitCode is 
defined as LongInt (both in systemh.inc). Is that a mistake? Is it on 
purpose? Can I change it or at least circumvent it? By defining 
maxExitCode as High(Word)? Is that really the intention of this define 
and the correct use of that constant?

Regards,
Sven



More information about the fpc-devel mailing list