1

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?

Matthias B
  • 404
  • 4
  • 11
  • 1
    Have you tried `dcc32 myapp -h-`? – Andreas Rejbrand Apr 01 '21 at 20:11
  • That leads straight to the correct answer - thank you! (I had looked at the help output using dcc32 -h, but as the help said only "-H = Output hint messages", and did not include the +/- options (as "-W[+|-|^][warn_id] = Output warning messages" does), that simple solution had not occurred to me. But indeed, it works: the -H- option suppresses all warnings. – Matthias B Apr 01 '21 at 20:24
  • 2
    As a side note: Instead of hiding compiler warnings with a compiler option, you should better solve all those warnings by fixing the source code. If you don't, one day or later, they will hit you. For me, clean code = no warning at all. – fpiette Apr 02 '21 at 06:31
  • You are absolutely right, fpiette. We just don't have the time right now. Compilation outputs ~65 pages of hints, and these clutter the logs of our continuous integration and release builds, and we need a quick solution. It's not the way I'd prefer, either. Thank you for pointing it out! – Matthias B Apr 02 '21 at 17:52

1 Answers1

3

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.
Julius Tuskenis
  • 1,323
  • 8
  • 13