So I am including in my unit some other units and after building application I receive a huge amount of warnings from those units. The amount is so large that I'am having problems in finding my own warnings on the list. ;-)
Is there some compiler directive which would allow me to turn those warnings off? But please note, that I don't want to modify those units in any way. I would like to achieve something like this:
unit MyUnit;
interface
uses
UnitA, {$WARN EMIT_WARNNIGS OFF} UnitB, {$WARN EMIT_WARNNIGS ON} UnitC, UnitD.
implementation
uses
UnitE, {$WARN EMIT_WARNNIGS OFF} UnitF, UnitG, {$WARN EMIT_WARNNIGS ON} UnitH.
This is an imaginary compiler directive which I would like to have, or maybe it exists and I don't know about it?
Thanks for your time.
There is a compiler directive to turn warnings off, but this can only be set in either project options in which case it applies to all units, or in a unit itself in which case it applies to that unit alone.
So, you're left with a few options.
Unrealistic option that does exactly what you ask:
So the only solution would be to disable warnings in your project and then enable them in all your own units using that directive.
Easiest and most realistic option:
Compile the units once and only use the DCUs by removing the source from your library path. That's easiest if you do not want to edit them anyway.
You can still add them in your browsing path which is different from the library path. In that case, the DCUs are used, but Delphi can still find the sources, so you can still navigate them whilst debugging.
Small advantage is that building your project is faster too, because these units don't need to be recompiled on each build.
Best option:
Stop using those units at all. Units with so many warnings are inferior software and can cause serious problems.
Other solutions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With