Recent

Author Topic: Identifying and ignoring benign hints  (Read 4729 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Identifying and ignoring benign hints
« on: October 09, 2021, 06:03:47 pm »
This applies to Lazarus 2.0.6 with FPC 3.0.4 and later, on x86_64 Linux.

In the past I've gone through some of my frequently-used units making sure that hints were suppressed in cases where I knew they were benign:

Code: Pascal  [Select][+][-]
  1.         {%H- 5028 } lcl_fullversion = ((lcl_major *  100 + lcl_minor) * 100 + lcl_release) * 100 + lcl_patch;
  2.         {%H-}lcl_fullversion2 = ((lcl_major *  1000 + lcl_minor) * 1000 + lcl_release) * 1000 + lcl_patch;
  3.  

Has something changed in the IDE: the first form, with the error number, seems to no longer suppress the "unused" hint associated with that line while the second does?

Please could somebody remind me which compiler(?) option I need in order to see the error numbers in the message window, so that if it still works I can be precise about suppressing hints.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Identifying and ignoring benign hints
« Reply #1 on: October 11, 2021, 01:43:11 pm »
Please could somebody remind me which compiler(?) option I need in order to see the error numbers in the message window, so that if it still works I can be precise about suppressing hints.

You know that the compiler has a help output listing all supported options? ;)

Code: [Select]
-v<x>  Be verbose. <x> is a combination of the following letters:
      e : Show errors (default)       0 : Show nothing (except errors)
      w : Show warnings               u : Show unit info
      n : Show notes                  t : Show tried/used files
      h : Show hints                  c : Show conditionals
      i : Show general info           d : Show debug info
      l : Show linenumbers            r : Rhide/GCC compatibility mode
      s : Show time stamps            q : Show message numbers
      a : Show everything             x : Show info about invoked tools
      b : Write file names messages   p : Write tree.log with parse tree
          with full path              v : Write fpcdebug.txt with
      z : Write output to stderr          lots of debugging info
      m<x>,<y> : Do not show messages numbered <x> and <y>

So what you're looking for is -vq.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Identifying and ignoring benign hints
« Reply #2 on: October 11, 2021, 02:13:20 pm »
You know that the compiler has a help output listing all supported options? ;)

Yes, and I explicitly checked that in case I was overlooking something.

Quote
So what you're looking for is -vq.

I've already got it in my custom options:


-dHAS_SVN
-dHAS_FPC_SVN
-vq


and Lazarus isn't displaying the error numbers:


Project: Executing command before: Success
Compile Project, Target: gpx_static_diff: Success, Hints: 5
inifilesabout.pas(687,25) Hint: Local variable "binfile" does not seem to be initialized
inifilesabout.pas(688,72) Hint: Local variable "secLen" does not seem to be initialized
inifilesabout.pas(688,64) Hint: Local variable "secOfs" does not seem to be initialized
inifilesabout.pas(694,20) Hint: Local variable "idBuff" does not seem to be initialized
inifilesabout.pas(699,45) Hint: Local variable "i" does not seem to be initialized
Project: Executing command after: Success
Mon 11 Oct 13:10:59 BST 2021


It used to, with (I think) the same projects... and I can't see what I've changed.

MarkMLl

MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Identifying and ignoring benign hints
« Reply #3 on: October 11, 2021, 02:28:39 pm »
You know that the compiler has a help output listing all supported options? ;)
With the Annoyance you have to specify each by item, Sarah....
Specialize a type, not a var.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Identifying and ignoring benign hints
« Reply #4 on: October 11, 2021, 02:50:10 pm »
You know that the compiler has a help output listing all supported options? ;)
With the Annoyance you have to specify each by item, Sarah....

Steady on, I might have been using a Mac and as such (apparently) unable to view such things.

(I seem to be spending a lot of time pouring oil on troubled flames :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

prof7bit

  • Full Member
  • ***
  • Posts: 161
Re: Identifying and ignoring benign hints
« Reply #5 on: October 11, 2021, 04:38:04 pm »
Lazarus is removing the numbers, they are visible in the raw FPC output.

Message window: right click | Options | Show Message Type ID


MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Identifying and ignoring benign hints
« Reply #6 on: October 11, 2021, 05:03:16 pm »
Lazarus is removing the numbers, they are visible in the raw FPC output.

Message window: right click | Options | Show Message Type ID

Thanks very much: that's it. I knew there was something in there somewhere.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Identifying and ignoring benign hints
« Reply #7 on: October 12, 2021, 09:05:21 am »
You know that the compiler has a help output listing all supported options? ;)
With the Annoyance you have to specify each by item, Sarah....

MarkMLI explicitly asked for a way to display the numbers. It's up to him whether he wants to hide them all or specific ones. One person's annoyance is another's joy... or so... ;)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Identifying and ignoring benign hints
« Reply #8 on: October 12, 2021, 09:30:39 am »
MarkMLI explicitly asked for a way to display the numbers. It's up to him whether he wants to hide them all or specific ones. One person's annoyance is another's joy... or so... ;)

I remember that when I first set this up (specifically so that I could avoid gross %H-) I had to get both the -vq and the Lazarus setting right. I very much appreciate that excessively-verbose messages can be annoying, but with the doctrine being that hints and (more particularly) warnings should be investigated and fixed (or at least masked) individually I think this stuff is needed on occasion.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Identifying and ignoring benign hints
« Reply #9 on: October 16, 2021, 11:36:32 am »
What should we call these things: antihints? :-)

At least with Lazarus 2.0.12 it appears as though spaces are significant:

This fragment, i.e. with spaces between the - and closing comment,

Code: Pascal  [Select][+][-]
  1.     procedure DrawGridTerminalPrepareCanvas(sender{%H- }: TObject; {%H- }aCol,
  2.       {%H- }aRow: Integer; {%H- }aState: TGridDrawState);
  3.  

gives me these unwanted hints


terminaldisplaycode.pas(49,74) Hint: (5024) Parameter "aCol" not used
terminaldisplaycode.pas(50,13) Hint: (5024) Parameter "aRow" not used
terminaldisplaycode.pas(50,34) Hint: (5024) Parameter "aState" not used


while if I remove the trailing space those three hints disappear.

However in the first case, i.e. where the error position is shown after the sender, the antihint is accepted whether or not there is a trailing space inside the comment.

I'm having difficulty getting the form {%H- 5024 } to do anything useful irrespective of spaces.

MarkMLl
« Last Edit: October 16, 2021, 11:41:40 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018