bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why 'statement may have no effect' lint warning here?


From: arnold
Subject: Re: Why 'statement may have no effect' lint warning here?
Date: Wed, 14 Apr 2021 11:09:51 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Manuel Collado <mcollado2011@gmail.com> wrote:

> Well, a semantically valid code may lead to several --lint warnings.
>
> $ gawk --lint "BEGIN{ a == b && b = 42 }"
> gawk: cmd. line:1: warning: statement may have no effect
> gawk: cmd. line:1: warning: reference to uninitialized variable `a'
> gawk: cmd. line:1: warning: reference to uninitialized variable `b'
> gawk: cmd. line:1: warning: assignment used in conditional context
>
> I assume only the first warning is under discussion.

Correct.

> I've had a quick look at the gawk source code, and see you are quite
> right. As a last chance option the syntax tree could perhaps be rebuilt
> by a code similar to the pretty-print in profile.c.

No need. I think the patch I just sent out and pushed handles it.

Thanks,

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]