Discussion:
[Lazarus] About a warning of unused parameter.
Carlos E. R. via Lazarus
2018-05-02 00:19:05 UTC
Permalink
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)
Mattias Gaertner via Lazarus
2018-05-02 06:04:51 UTC
Permalink
On Wed, 2 May 2018 02:19:05 +0200
Post by Carlos E. R. via Lazarus
[...]
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>
Post by Carlos E. R. via Lazarus
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
{$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
--
Carlos E. R. via Lazarus
2018-05-02 10:31:15 UTC
Permalink
Post by Mattias Gaertner via Lazarus
Post by Carlos E. R. via Lazarus
[...]
function TPINGSend.Checksum6(Value: AnsiString): Word;
begin
Result := 0;
end;
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>
Post by Carlos E. R. via Lazarus
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
{$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)
Mattias Gaertner via Lazarus
2018-05-02 10:34:22 UTC
Permalink
On Wed, 2 May 2018 12:31:15 +0200
Post by Carlos E. R. via Lazarus
[...]
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
--
Juha Manninen via Lazarus
2018-05-02 15:50:03 UTC
Permalink
On Wed, May 2, 2018 at 1:31 PM, Carlos E. R. via Lazarus
Post by Carlos E. R. via Lazarus
Then I'll wait till that update reaches me :-)
svn up
--

Loading...