New {$WARN} wrapper .inc files added

Several new .inc files have been added to Indy’s source:

IdSymbolDeprecatedOff.inc
IdSymbolDeprecatedOn.inc
IdSymbolPlatformOff.inc
IdSymbolPlatformOn.inc
IdUnitPlatformOff.inc
IdUnitPlatformOn.inc
IdDeprecatedImplBugOff.inc
IdDeprecatedImplBugOn.inc

For example:

Before:

  {$IFDEF HAS_SYMBOL_PLATFORM}
    {$WARN SYMBOL_PLATFORM OFF}
  {$ENDIF}
TIdThreadPriority = TThreadPriority;
  {$IFDEF HAS_SYMBOL_PLATFORM}
    {$WARN SYMBOL_PLATFORM ON}
  {$ENDIF}

{$IFDEF HAS_DEPRECATED}
  {$WARN SYMBOL_DEPRECATED OFF}
{$ENDIF}
GIdIPv6FuncsAvailable := False;
{$IFDEF HAS_DEPRECATED}
  {$IFDEF HAS_DIRECTIVE_WARN_DEFAULT}
    {$WARN SYMBOL_DEPRECATED DEFAULT}
  {$ELSE}
    {$WARN SYMBOL_DEPRECATED ON}
  {$ENDIF}
{$ENDIF}

After:

  {$I IdSymbolPlatformOff.inc}
TIdThreadPriority = TThreadPriority;
  {$I IdSymbolPlatformOn.inc}

{$I IdSymbolDeprecatedOff.inc}
GIdIPv6FuncsAvailable := False;
{$I IdSymbolDeprecatedOn.inc}

The last two .inc files – IdDeprecatedImplBugOff.inc and IdDeprecatedImplOn.inc – are a special case that requires extra explanation.

In Delphi 6 (when deprecated was introduced), there is a compiler bug where if a procedure/function/method is marked as deprecated then the compiler emits a warning about the deprecated symbol being used in the procedure/function/method’s implementation, which is not desirable (and was fixed in Delphi 7). As such, Indy’s deprecated method implementations are now wrapped with these two files, for example:

Before:

procedure SplitColumnsNoTrim(const AData: string; AStrings: TStrings; const ADelim: string = ' '); {$IFDEF HAS_DEPRECATED}deprecated{$IFDEF HAS_DEPRECATED_MSG} 'Use SplitDelimitedString()'{$ENDIF};{$ENDIF} {Do not Localize}

{$IFDEF DEPRECATED_IMPL_BUG}
  {$WARN SYMBOL_DEPRECATED OFF}
{$ENDIF}
procedure SplitColumnsNoTrim(const AData: string; AStrings: TStrings; const ADelim: string = ' ');
{$IFDEF DEPRECATED_IMPL_BUG}
  {$WARN SYMBOL_DEPRECATED ON}
{$ENDIF}
begin
  SplitDelimitedString(AData, AStrings, False, ADelim{$IFNDEF USE_OBJECT_ARC}, True{$ENDIF});
end;

After:

procedure SplitColumnsNoTrim(const AData: string; AStrings: TStrings; const ADelim: string = ' '); {$IFDEF HAS_DEPRECATED}deprecated{$IFDEF HAS_DEPRECATED_MSG} 'Use SplitDelimitedString()'{$ENDIF};{$ENDIF} {Do not Localize}

{$I IdDeprecatedImplBugOff.inc}
procedure SplitColumnsNoTrim(const AData: string; AStrings: TStrings; const ADelim: string = ' ');
{$I IdDeprecatedImplBugOn.inc}
begin
  SplitDelimitedString(AData, AStrings, False, ADelim{$IFNDEF USE_OBJECT_ARC}, True{$ENDIF});
end;