Sign in Join

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

Mailing lists / lazarus / 2018-05

About a warning of unused parameter.

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Carlos E. R.

Hi,

I'm experimenting with doing "ping host" on Lazarus using the Synapse library (http://synapse.ararat.cz/doku.php/download). The code on my side is very simple, I just have to "use pingsend", then basically ping.ping('some host');

I have a little nuisance: building the included library produces a ton of warnings. This thing was last updated on 2012 (release no. 40).

For instance, this one:

pingsend.pas(137,24) Hint: Parameter "Value" not used
The code is different on Windows or Linux, by using {$IFDEF MSWINDOWS}
clauses. On Linux, the effective code is;
function TPINGSend.Checksum6(Value: AnsiString): Word;
begin
  Result := 0;
end;

So the warning is true, but I don't see what I can do about it without changing the function definition (I could just not call the function in Linux). I can do:

  Result := 0;
  Value:='';

but that just changes the warning to:

pingsend.pas(137,24) Hint: Value parameter "Value" is assigned but never
used

which is of course true.

So I wonder if there is something to silence that particular warning alone. Say, yes, I know about that one, shut up.

I see on the contextual menu of the warning that I can silence that warning type on a file (all warnings of that type in that file, not just the ones I know about):

{$WARN 5024 off : Parameter "$1" not used}

Lazarus writes "on"; tried both. Neither work, the warning still appears.

Ideas?

Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180502/42281e2a/attachment.sig>

Reply by email

Mattias Gaertner
to Carlos E. R.
Show quoted text 5 lines
[...] function TPINGSend.Checksum6(Value: AnsiString): Word; begin Result := 0; end;

You can:
a) add a dummy statement: if Value='' then ;
b) add an IDE directive: right click on this message in the Lazarus Messages window, Hide message by inserting IDE directive

Mattias>

Show quoted text 7 lines
I see on the contextual menu of the warning that I can silence that warning type on a file (all warnings of that type in that file, not just the ones I know about): {$WARN 5024 off : Parameter "$1" not used} Lazarus writes "on"; tried both. Neither work, the warning still appears.

It should be "off". I fixed that in trunk.

Mattias

Reply by email

Carlos E. R.
to Mattias Gaertner
Mattias Gaertner wrote 23 lines
On Wed, 2 May 2018 02:19:05 +0200 "Carlos E. R. via Lazarus" wrote: > [...] > function TPINGSend.Checksum6(Value: AnsiString): Word; > begin > Result := 0; > end; You can: a) add a dummy statement: if Value='' then ; b) add an IDE directive: right click on this message in the Lazarus Messages window, Hide message by inserting IDE directive Mattias> > I see on the contextual menu of the warning that I can silence that > warning type on a file (all warnings of that type in that file, not just > the ones I know about): > > {$WARN 5024 off : Parameter "$1" not used} > > Lazarus writes "on"; tried both. Neither work, the warning still appears. It should be "off". I fixed that in trunk.

Then I'll wait till that update reaches me :-)

I do not want to kill the warning for all files, only those I have reviewed.

Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180502/a00bee7d/attachment.sig>

Reply by email

Mattias Gaertner
to Carlos E. R.
[...] Then I'll wait till that update reaches me :-) I do not want to kill the warning for all files, only those I have reviewed.

Same here. That's why I often use the IDE directive.

Mattias

Reply by email