[fpc-devel] Compiler directives in getopts unit

Bart bartjunk64 at gmail.com
Thu Jan 17 19:23:41 CET 2019


Hi,

I'm trying to fix an issue in getopts unit.
I noticed some (ancient?) compiler directives:

{$IFNDEF FPC}
  {$ifdef TP}
    uses strings;
  {$else }
    uses SysUtils;
    type PtrInt = Integer;
  {$endif}
{$ENDIF FPC}

{$IF not Declared(argv)} //{$ifdef TP}
type
  ppchar = ^pchar;
  apchar = array[0..127] of pchar;
var
  argc  : longint;
  argv  : apchar;
....

{ create argv if running under TP }
{$ifndef FPC}
  setup_arguments;
{$endif}


It seems this code at one time needed to be compilable with TP.
AFAIK TP however does not support {$IF CONDITION} nor the Declared()
macro(?), so the source should not be compilable anymore with TP?

The unit is still compileable with Delphi (7) though.

Question is: do we need to keep that in?
I don't think it is possible anymore to bootstrap the compiler with
anything other than FPC?

As for the {$IF not Declared(Argv)} part: does that apply to a target
that FPC supports or is also there just to be able to compile it with
Delphi?

If we keep it, then at least the comments should be updated.

Bart
-- 
Bart



More information about the fpc-devel mailing list