Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

{$WARN SYMBOL_PLATFORM OFF} does not turn off warnings

I have this piece of code:

INTERFACE

{$WARN SYMBOL_PLATFORM OFF}
USES
   Winapi.Windows, etc, {$IFDEF MSWINDOWS}Vcl.FileCtrl, {$ENDIF} System.IniFiles;
{$WARN SYMBOL_PLATFORM ON}

The compiler shows:

[dcc32 Warning] W1005 Unit 'Vcl.FileCtrl' is specific to a platform

even though the {$WARN SYMBOL_PLATFORM OFF} is there.
Why?

like image 965
Server Overflow Avatar asked Sep 23 '16 08:09

Server Overflow


1 Answers

You are using the wrong directive. SYMBOL_PLATFORM controls warnings for symbols marked platform specific. Your warning relates to a unit marked platform specific.

Control these warnings with UNIT_PLATFORM.

The whole unit is tagged (using the platform hint directive) as one that contains material that might not be available on all platforms. If you are writing multi-device applications, the unit might cause a problem. For example, a unit that uses objects defined in OleAuto might be tagged using the PLATFORM directive.

The $WARN UNIT_PLATFORM ON/OFF compiler directive turns on or off all warnings about the platform directive in units where the platform directive is specified.


There's a really easy way for you to work this out for yourself. Take a look at the two documentation topics I linked to above. Their titles are:

  • W1002 Symbol '%s' is specific to a platform (Delphi)
  • W1005 Unit '%s' is specific to a platform (Delphi)

The compiler warning that you received names the warning as W1005. This is all you need to know to determine which directive to use to control it. If you have any trouble finding them simply search for the warning name, W1005 in this instance. Or refer to the documentation that lists them all.

like image 68
David Heffernan Avatar answered Sep 26 '22 19:09

David Heffernan