[Lazarus] About a warning of unused parameter.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] About a warning of unused parameter.

Free Pascal - Lazarus mailing list
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)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] About a warning of unused parameter.

Free Pascal - Lazarus mailing list
On Wed, 2 May 2018 02:19:05 +0200
"Carlos E. R. via Lazarus" <[hidden email]> 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.

Mattias
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] About a warning of unused parameter.

Free Pascal - Lazarus mailing list
On 2018-05-02 08:04, Mattias Gaertner via Lazarus wrote:

> 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)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] About a warning of unused parameter.

Free Pascal - Lazarus mailing list
On Wed, 2 May 2018 12:31:15 +0200
"Carlos E. R. via Lazarus" <[hidden email]> wrote:

>[...]
> 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
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] About a warning of unused parameter.

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Wed, May 2, 2018 at 1:31 PM, Carlos E. R. via Lazarus
<[hidden email]> wrote:
> Then I'll wait till that update reaches me :-)

svn up
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus