Search code examples
delphidelphi-10.4-sydneydcc32delphi-10.4.2

Suppress hints in the Delphi command-line compilers (dcc32.exe etc.)


How do I suppress hints when using the Delphi command-line compilers? (I.e. dcc32.exe, dcc64.exe, dcclinux64.exe etc.)

I know that {$HINTS OFF} can be used in the source code to turn hints off, but its scope is local and affects only the code in the unit where is placed. I would want a global option that affects the whole compilation.

I also know that when compiling in the IDE, one can turn hints off globally in Project Options > Building > Delphi Compiler > Hints and Warnings > Output hints (True/False). I would need the same option in the command-line compilers.

Warnings can be suppressed using the -W-[WARNING] option, but is there anything similar for hints?


Solution

  • Running DCC32.EXE shows:

    Hints are controlled using -H option

    Show Hints (use -H+ or no option at all, as it is the default behavior):

    D:\Tmp\TestHint>"C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\DCC32.EXE" -H+ "D:\Tmp\TestHint\Project1.dpr"
    Embarcadero Delphi for Win32 compiler version 33.0
    Copyright (c) 1983,2018 Embarcadero Technologies, Inc.
    Project1.dpr(11) Hint: H2164 Variable 'Unused' is declared but never used in 'Project1'
    Project1.dpr(20)
    21 lines, 0.08 seconds, 118868 bytes code, 28648 bytes data.
    

    Hide hints (use -H-):

    D:\Tmp\TestHint>"C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\DCC32.EXE" -H- "D:\Tmp\TestHint\Project1.dpr"
    Embarcadero Delphi for Win32 compiler version 33.0
    Copyright (c) 1983,2018 Embarcadero Technologies, Inc.
    Project1.dpr(20)
    21 lines, 0.09 seconds, 118868 bytes code, 28648 bytes data.