gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2560-g0f9d43


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2560-g0f9d435
Date: Sat, 20 May 2017 16:14:21 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  0f9d4355a03d000938d87d71ba62f0ac2717334a (commit)
       via  5dad1227c5c8a14641aaeb78cdd423d584890c24 (commit)
      from  b2651a80b9a238a0372dc6f89f5ea81c75326914 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0f9d4355a03d000938d87d71ba62f0ac2717334a

commit 0f9d4355a03d000938d87d71ba62f0ac2717334a
Author: Arnold D. Robbins <address@hidden>
Date:   Sat May 20 22:28:59 2017 +0300

    Make lint checking for "no effect" case smarter about line numbers.

diff --git a/ChangeLog b/ChangeLog
index 59fb425..3f18632 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-20         Arnold D. Robbins     <address@hidden>
+
+       * awkgram.y (add_lint): Make ``no effect'' check smarter about
+       reporting line numbers.
+
 2017-05-01         Arnold D. Robbins     <address@hidden>
 
        * awkgram.y (nextc): Fix to change of 2017-04-24 such that
diff --git a/awkgram.c b/awkgram.c
index 1d06c4d..4325e77 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8324,12 +8324,22 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype)
 
        case LINT_no_effect:
                if (list->lasti->opcode == Op_pop && list->nexti != 
list->lasti) {
-                       for (ip = list->nexti; ip->nexti != list->lasti; ip = 
ip->nexti)
-                               ;
+                       int line = 0;
+
+                       // Get down to the last instruction (FIXME: why?)
+                       for (ip = list->nexti; ip->nexti != list->lasti; ip = 
ip->nexti) {
+                               // along the way track line numbers, we will 
use the line
+                               // closest to the opcode if that opcode doesn't 
have one
+                               if (ip->source_line != 0)
+                                       line = ip->source_line;
+                       } 
 
                        if (do_lint) {          /* compile-time warning */
-                               if (isnoeffect(ip->opcode))
-                                       lintwarn_ln(ip->source_line, 
("statement may have no effect"));
+                               if (isnoeffect(ip->opcode)) {
+                                       if (ip->source_line != 0)
+                                               line = ip->source_line;
+                                       lintwarn_ln(line, ("statement may have 
no effect"));
+                               }
                        }
 
                        if (ip->opcode == Op_push) {            /* run-time 
warning */
diff --git a/awkgram.y b/awkgram.y
index b72d1c8..e4f5bab 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5904,12 +5904,22 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype)
 
        case LINT_no_effect:
                if (list->lasti->opcode == Op_pop && list->nexti != 
list->lasti) {
-                       for (ip = list->nexti; ip->nexti != list->lasti; ip = 
ip->nexti)
-                               ;
+                       int line = 0;
+
+                       // Get down to the last instruction (FIXME: why?)
+                       for (ip = list->nexti; ip->nexti != list->lasti; ip = 
ip->nexti) {
+                               // along the way track line numbers, we will 
use the line
+                               // closest to the opcode if that opcode doesn't 
have one
+                               if (ip->source_line != 0)
+                                       line = ip->source_line;
+                       } 
 
                        if (do_lint) {          /* compile-time warning */
-                               if (isnoeffect(ip->opcode))
-                                       lintwarn_ln(ip->source_line, 
("statement may have no effect"));
+                               if (isnoeffect(ip->opcode)) {
+                                       if (ip->source_line != 0)
+                                               line = ip->source_line;
+                                       lintwarn_ln(line, ("statement may have 
no effect"));
+                               }
                        }
 
                        if (ip->opcode == Op_push) {            /* run-time 
warning */
diff --git a/test/ChangeLog b/test/ChangeLog
index 2ef21c6..2942f7b 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-20         Arnold D. Robbins     <address@hidden>
+
+       * noeffect.awk, noeffect.ok: Updated after code change.
+
 2017-05-01         Aharon Robbins       <address@hidden>
 
        * Makefile.am (sourcesplit): New test.
diff --git a/test/noeffect.awk b/test/noeffect.awk
index b67a5c5..472c408 100644
--- a/test/noeffect.awk
+++ b/test/noeffect.awk
@@ -2,4 +2,5 @@ BEGIN {
        s == "hello, world";
        s + 1
        ;;
+       "s" 1
 }
diff --git a/test/noeffect.ok b/test/noeffect.ok
index e9bed99..6a0cc75 100644
--- a/test/noeffect.ok
+++ b/test/noeffect.ok
@@ -1,4 +1,5 @@
 gawk: noeffect.awk:2: warning: statement may have no effect
 gawk: noeffect.awk:3: warning: statement may have no effect
+gawk: noeffect.awk:5: warning: statement may have no effect
 gawk: noeffect.awk:2: warning: reference to uninitialized variable `s'
 gawk: noeffect.awk:3: warning: reference to uninitialized variable `s'

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5dad1227c5c8a14641aaeb78cdd423d584890c24

commit 5dad1227c5c8a14641aaeb78cdd423d584890c24
Author: Arnold D. Robbins <address@hidden>
Date:   Sat May 20 22:20:10 2017 +0300

    Add a known issue to test/README.

diff --git a/test/README b/test/README
index 2343be2..61976b8 100644
--- a/test/README
+++ b/test/README
@@ -1,4 +1,5 @@
 Mon Jan 22 13:08:58 EST 1996
+============================
 
 This directory contains the tests for gawk.  The tests use the
 following conventions.
@@ -16,3 +17,8 @@ compare actual and expected results, in case they differ.
 
 If they do differ (other than strftime.ok and _strftime!), send in a
 bug report.  See the manual for the bug report procedure.
+
+Known Issues:
+=============
+May 2017: On a system with no ptys available, the pty1 test will hang.
+There isn't anything that can be done about this.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |  5 +++++
 awkgram.c         | 18 ++++++++++++++----
 awkgram.y         | 18 ++++++++++++++----
 test/ChangeLog    |  4 ++++
 test/README       |  6 ++++++
 test/noeffect.awk |  1 +
 test/noeffect.ok  |  1 +
 7 files changed, 45 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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