Recent

Author Topic: Effective Way To Disable Warnings / Hints By Unit?  (Read 1623 times)

del

  • Sr. Member
  • ****
  • Posts: 258
Effective Way To Disable Warnings / Hints By Unit?
« on: October 12, 2019, 01:52:12 am »
I've tried this:
Code: Pascal  [Select][+][-]
  1. unit blcksock;
  2. {$warnings off}
  3. {$hints off}
  4. {$notes off}
  5.  

I've tried this:
Code: Pascal  [Select][+][-]
  1. unit blcksock;
  2. {$warnings off}
  3. {$hints off}
  4. {$notes off}
  5. .......
  6.  end;
  7. {$warnings on}
  8. {$hints on}
  9. {$notes on}
  10. end.
  11.  

I've tried this:

Code: Pascal  [Select][+][-]
  1. implementation
  2. {$warnings off}
  3. {$hints off}
  4. {$notes off}
  5.  

I've tried disabling hints / warnings under Project-Project Options-Messages then enabling them in my units by

Code: Pascal  [Select][+][-]
  1. unit StatsMath;
  2. {$warnings on}
  3. {$hints on}
  4. {$notes on}
  5. ......
  6. end;
  7. {$warnings off}
  8. {$hints off}
  9. {$notes off}
  10. end.
  11.  

Which doesn't help at all - they all stay disabled. I get varying degrees of success with the other approaches. One unit which absolutely refuses to cooperate is "blcksock" - a part of the Ararat Synapse library. So basically I want all the warnings / hints for code that is not mine to be disabled. What's the best way to do this?

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Effective Way To Disable Warnings / Hints By Unit?
« Reply #1 on: October 13, 2019, 06:50:16 pm »
Problem solved. I'm solving all my own problems. That's the way you guys like it. Better to let him figure out how to fish than to just give him a fish. Cuz he'll just hungry again and pester us some more. OK - so I was inviting in all these dozens and dozens of warning and hints which had nothing to do with my own code.

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.

Thaddy

  • Hero Member
  • *****
  • Posts: 14364
  • Sensorship about opinions does not belong here.
Re: Effective Way To Disable Warnings / Hints By Unit?
« Reply #2 on: October 13, 2019, 07:08:53 pm »
So basically I want all the warnings / hints for code that is not mine to be disabled. What's the best way to do this?
Then you just compile FPC and Lazarus with warnings off etc. Either through the Lazarus IDE or through the FPC command line parameters.
That's also the official way to achieve that. E.g. make clean all install OPT='-vw-'. The compiler itself is compiled with -Sew so is unlikely to throw warnings  :D
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Effective Way To Disable Warnings / Hints By Unit?
« Reply #3 on: October 13, 2019, 07:50:22 pm »
Then you just compile FPC and Lazarus with warnings off etc. Either through the Lazarus IDE or through the FPC command line parameters.
That's also the official way to achieve that. E.g. make clean all install OPT='-vw-'. The compiler itself is compiled with -Sew so is unlikely to throw warnings  :D

I like warnings - the compiler is my friend. I just don't want to be warned about unused variables in obscure files deep inside third party packages. That ship has sailed.

 

TinyPortal © 2005-2018