bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Warning message issued with no source line number


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Warning message issued with no source line number
Date: Tue, 16 May 2017 20:08:04 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, May 16, 2017 at 07:51:39PM -0400, Peter J. Farley III wrote:
> Per discussion on the main gawk list, attached is the script which
> generates this warning message with no source line number:
> 
> gawk: warning: statement may have no effect
> 
> Invocation is as follows:
> 
> gawk --lint --posix -v SKIPAGES=0 -v DEBUG=0 -v MINCOL=120 -f
> onecol2.awk < /dev/null

Thanks. This can be simplified as follows:

bash-4.2$ cat /tmp/test.awk 
BEGIN {
    if (dbg) \
        print "DEBUG:maxndx=" maxndx ",allndx=" allndx \
              ",maxsum=" maxsum ",sumndx=" sumndx
              ",hx=" hx
}
bash-4.2$ gawk --lint -f /tmp/test.awk
gawk: warning: statement may have no effect
gawk: /tmp/test.awk:2: warning: reference to uninitialized variable `dbg'
gawk: /tmp/test.awk:5: warning: reference to uninitialized variable `hx'

The warning is due to the lack of the line continuation character after
"sumndx", but that doesn't explain why there is no filename or line number.
That requires further debugging.

Regards,
Andy



reply via email to

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