Recent

Author Topic: Disable Warnings and Hints from Units in packages  (Read 418 times)

Weitentaaal

  • Hero Member
  • *****
  • Posts: 516
  • Weitental is a very beautiful garbage depot.
Disable Warnings and Hints from Units in packages
« on: July 05, 2023, 11:24:40 am »
Hello,

i read some Post's about this but could not get it done.

Quote
https://forum.lazarus.freepascal.org/index.php?topic=47047.0

The reason that they were appearing is that in my project inspector I had explicit include paths to files which were inside packages. Instead of just making the package a "Required Package".

Now I've gotten rid of all my cherry-picked explicit paths to individual .pas files and have simply made the packages that they belong to "Required". This shut down all the warnings and hints from code that is not mine. I like it - now I can attack my own foibles and not be distracted by everything else in the ecosphere.

This did not work for me. I still got the warnings.

tried this
Code: Pascal  [Select][+][-]
  1. {$warnings off}
  2. unit AnyUnit;
  3. {$warnings on}
  4.  

did not work either. I still got the Warnings

I want all the warnings / hints for code that is not mine to be disabled. How do i do it ?
« Last Edit: July 05, 2023, 12:44:44 pm by Weitentaaal »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5462
  • Compiler Developer
Re: Disable Warnings and Hints from Units in packages
« Reply #1 on: July 05, 2023, 11:23:32 pm »
Hello,

i read some Post's about this but could not get it done.

Quote
https://forum.lazarus.freepascal.org/index.php?topic=47047.0

The reason that they were appearing is that in my project inspector I had explicit include paths to files which were inside packages. Instead of just making the package a "Required Package".

Now I've gotten rid of all my cherry-picked explicit paths to individual .pas files and have simply made the packages that they belong to "Required". This shut down all the warnings and hints from code that is not mine. I like it - now I can attack my own foibles and not be distracted by everything else in the ecosphere.

This did not work for me. I still got the warnings.

tried this
Code: Pascal  [Select][+][-]
  1. {$warnings off}
  2. unit AnyUnit;
  3. {$warnings on}
  4.  

did not work either. I still got the Warnings

I want all the warnings / hints for code that is not mine to be disabled. How do i do it ?

You can't disable warnings/hints this way.

The point with the package mentioned above is that a package is compiled by Lazarus and ideally only recompiled again when the units of the package are changed. Otherwise the compiler will use the precompiled units and warnings and hints that would be triggered during compilation will not be triggered if a precompiled unit is used.

So if you put your units into a separate package, with the sources located in a different directory than your main project, then any warnings/hints should only be shown when Lazarus decides to recompile the package. If you still get them then you're doing something wrong and you should explain your setup in more detail.

Weitentaaal

  • Hero Member
  • *****
  • Posts: 516
  • Weitental is a very beautiful garbage depot.
Re: Disable Warnings and Hints from Units in packages
« Reply #2 on: July 06, 2023, 10:00:06 am »
You can't disable warnings/hints this way.

The point with the package mentioned above is that a package is compiled by Lazarus and ideally only recompiled again when the units of the package are changed. Otherwise the compiler will use the precompiled units and warnings and hints that would be triggered during compilation will not be triggered if a precompiled unit is used.

So if you put your units into a separate package, with the sources located in a different directory than your main project, then any warnings/hints should only be shown when Lazarus decides to recompile the package. If you still get them then you're doing something wrong and you should explain your setup in more detail.

ah it's because i use the Option "Clean up and compile" (translated from german) now and then.

Thanks for the explanation !

 

TinyPortal © 2005-2018