Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-09

Howto hide Hint: Parameter "xxx" not used

15 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi.

Is there any posibility to hide compiler hint:
Hint: Parameter "xxx" not used

Other hints I want to see, but this is by my opinion useless and only makes dirty compiler output. I cannot effectively suppres it in my code. For examle:
procedure TObj.OnEvent(Sender: TObject);

Sometimes I need Sender, sometimes not.

Now I use this hack: make | grep -v 'Hint: Parameter ".*" not used' but some plain solution is welcome.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Is there any posibility to hide compiler hint: Hint: Parameter "xxx" not used

No. People regularly ask for the ability to disable particular hints/ warnings, but no one is interested enough to submit a patch to add such functionality to the compiler (the compiler developers aren't either, at least not until now).

Jonas

Reply by email

Graeme Geldenhuys
to Unknown author: Hi. Is there any posibility to hide compiler hint: Hint: Parameter "xxx" not used Other…
Is there any posibility to hide compiler hint: Hint: Parameter "xxx" not used

I agree, it would be nice to suppress that hint! It's quite pointless, 99% of the time.

I have seen some code like the following, to suppress that hint, but it's just a ugly hack as far as I'm concerned.

procedure TObj.OnEvent(Sender: TObject);
begin
  Assert(Sender  nil);    // to get rid of compiler warning!
  ...
end;

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Vincent Snijders
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
On Mon, Sep 29, 2008 at 11:18 AM, wrote: > Is there any posibility to hide compiler hint: > Hint: Parameter "xxx" not used I agree, it would be nice to suppress that hint! It's quite pointless, 99% of the time.

For this particular hint with Sender, there is an option to surpress it, when you use Lazarus. Project -> Compiler Options -> Messages -> Show Hints for parameter "Sender" not used.

For a more general approach, see this thread:
http://www.lazarus.freepascal.org/pipermail/lazarus/2008-September/019997.html

Vincent

Reply by email

Paul Ishenin
to Jonas Maebe: No. People regularly ask for the ability to disable particular hints/ warnings, but no…

Jonas Maebe пишет:

Show quoted text 10 lines
On 29 Sep 2008, at 11:18, wrote: > Is there any posibility to hide compiler hint: > Hint: Parameter "xxx" not used No. People regularly ask for the ability to disable particular hints/warnings, but no one is interested enough to submit a patch to add such functionality to the compiler (the compiler developers aren't either, at least not until now).

Look here:
http://www.lazarus.freepascal.org/pipermail/lazarus/2008-September/019997.html

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 10 lines
Jonas Maebe пишет: > On 29 Sep 2008, at 11:18, wrote: >> Is there any posibility to hide compiler hint: >> Hint: Parameter "xxx" not used > No. People regularly ask for the ability to disable particular > hints/warnings, but no one is interested enough to submit a patch > to add such functionality to the compiler (the compiler developers > aren't either, at least not until now). Look here: http://www.lazarus.freepascal.org/pipermail/lazarus/2008-September/019997.html

That's just a hack, and you have to regenerate the message file for every new FPC release.

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe

Jonas Maebe пишет:

Show quoted text 18 lines
On 29 Sep 2008, at 11:31, Paul Ishenin wrote: > Jonas Maebe пишет: >> On 29 Sep 2008, at 11:18, wrote: >>> Is there any posibility to hide compiler hint: >>> Hint: Parameter "xxx" not used >> No. People regularly ask for the ability to disable particular >> hints/warnings, but no one is interested enough to submit a patch to >> add such functionality to the compiler (the compiler developers >> aren't either, at least not until now). > > Look here: > http://www.lazarus.freepascal.org/pipermail/lazarus/2008-September/019997.html > That's just a hack, and you have to regenerate the message file for every new FPC release.

Ofcource, but what can we do simple fpc users ;)

It will be nice if you implement it similar to delphi way:

{$WARN UNSAFE_CODE OFF}
{$WARN SYMBOL_DEPRECATED ON}

and same with hints

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 5 lines
Jonas Maebe пишет: > That's just a hack, and you have to regenerate the message file for > every new FPC release. Ofcource, but what can we do simple fpc users ;)

Submit a patch. The message handling code really isn't rocket science. It's pretty much all in compiler/verbose.pas

Jonas

BTW: some silly spam filter is bouncing all messages in this thread back to the list because it has 'xxx' in the subject...

Reply by email

Unknown author
to Jonas Maebe
Jonas Maebe wrote 11 lines
On 29 Sep 2008, at 11:41, Paul Ishenin wrote: > Jonas Maebe ??????????: >> That's just a hack, and you have to regenerate the message file for every >> new FPC release. > > Ofcource, but what can we do simple fpc users ;) Submit a patch. The message handling code really isn't rocket science. It's pretty much all in compiler/verbose.pas

In the attachment is a little patch. With cmdline option -vm05024,05025 you can suppress messages with idx 05024 and 05025.

But I'am not sure if really realized msgtxt.inc rocket science :). That is why I do not change fpc help message in the patch.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 18 lines
On Mon, Sep 29, 2008 at 11:49:29AM +0200, Jonas Maebe wrote: > > On 29 Sep 2008, at 11:41, Paul Ishenin wrote: > >> Jonas Maebe ??????????: >>> That's just a hack, and you have to regenerate the message file >>> for every >>> new FPC release. >> >> Ofcource, but what can we do simple fpc users ;) > > Submit a patch. The message handling code really isn't rocket > science. It's > pretty much all in compiler/verbose.pas In the attachment is a little patch. With cmdline option - vm05024,05025 you can suppress messages with idx 05024 and 05025.

It's a good start, but this patch is not ready to be committed: a) it is limited to 10 suppressions
b) people have to look up the error number in the message file first c) if you change the limitation in a), the code will become exponentially slower do to having to go over the entire suppression array every time a message has to be shown

A better approach may be to add a method to TMessage (in the cmsg.pas unit) to clear the verbosity level (replace all verbosity indicators with '_'). And to add an option to the compiler to also show the message number when printing output (so people can use this to get the numbers of the messages they want to suppress).

But I'am not sure if really realized msgtxt.inc rocket science :). That is why I do not change fpc help message in the patch.

It is automatically generated from compiler/msg/errore.msg (a plain text file) when you make the compiler. So just a patch to compiler/msg/ errore.msg is fine.

Thanks,

Jonas

Reply by email

Unknown author
to Jonas Maebe
Jonas Maebe wrote 20 lines
It's a good start, but this patch is not ready to be committed: a) it is limited to 10 suppressions b) people have to look up the error number in the message file first c) if you change the limitation in a), the code will become exponentially slower do to having to go over the entire suppression array every time a message has to be shown A better approach may be to add a method to TMessage (in the cmsg.pas unit) to clear the verbosity level (replace all verbosity indicators with '_'). And to add an option to the compiler to also show the message number when printing output (so people can use this to get the numbers of the messages they want to suppress). > But I'am not sure if really realized msgtxt.inc rocket science :). That is > why I do not > change fpc help message in the patch. It is automatically generated from compiler/msg/errore.msg (a plain text file) when you make the compiler. So just a patch to compiler/msg/errore.msg is fine.

Hi

Here is another attempt which respects your comments.

Cmdline option:
-vm showns msg numbers in listing
-vm11004m1018 disables showing msg numbers 11004 and 1018

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 5 lines
Here is another attempt which respects your comments. Cmdline option: -vm showns msg numbers in listing -vm11004m1018 disables showing msg numbers 11004 and 1018

I've committed a modified version of your patch (mainly extra error checking). The parameters now are
-vq to show message numbers
-vm11004,1018 to mask the messages numbered 11004 and 1018

(you cannot put any other -v<x> parameters anymore after -vm this way, but I think it's clearer).

Thanks for the patch.

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe
Jonas Maebe wrote 13 lines
> Here is another attempt which respects your comments. > > Cmdline option: > -vm showns msg numbers in listing > -vm11004m1018 disables showing msg numbers 11004 and 1018 I've committed a modified version of your patch (mainly extra error checking). The parameters now are -vq to show message numbers -vm11004,1018 to mask the messages numbered 11004 and 1018 (you cannot put any other -v<x> parameters anymore after -vm this way, but I think it's clearer).

Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN xxx ON} to use them per unit?

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 12 lines
Jonas Maebe wrote: > > I've committed a modified version of your patch (mainly extra error > checking). The parameters now are > -vq to show message numbers > -vm11004,1018 to mask the messages numbered 11004 and 1018 > (you cannot put any other -v<x> parameters anymore after -vm this > way, but I think it's clearer). Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN xxx ON} to use them per unit?

Feel free to file a bug report with a feature request.

Jonas

Reply by email

Jonas Maebe
to Jonas Maebe
Jonas Maebe wrote 9 lines
On 13 Oct 2008, at 03:37, Paul Ishenin wrote: > Jonas Maebe wrote: > > > Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN > xxx ON} to use them per unit? Feel free to file a bug report with a feature request.

Or to submit a patch... (compiler/scandir.pas, I believe there's even already a skeleton for this functionality available, search for dir_warn or so)

Jonas

Reply by email