aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-24 18:39:23 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-24 18:39:23 +0300
commitfe18b51cdabcc4d0d035c69de858db831b609d1a (patch)
tree1ca5fca0762175cb7ba0fffd3c93de4b5e889d15
parentb6de667a0fde62f36fdad941c948a03ae9356745 (diff)
parentd612fd1101a506bb657dcecebf136d5a433fa449 (diff)
downloadegawk-fe18b51cdabcc4d0d035c69de858db831b609d1a.tar.gz
egawk-fe18b51cdabcc4d0d035c69de858db831b609d1a.tar.bz2
egawk-fe18b51cdabcc4d0d035c69de858db831b609d1a.zip
Merge branch 'master' into feature/fix-comments
-rw-r--r--ChangeLog6
-rw-r--r--awkgram.c2
-rw-r--r--awkgram.y2
-rw-r--r--test/ChangeLog4
-rw-r--r--test/noeffect.awk4
-rw-r--r--test/noeffect.ok3
6 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5af9a0f1..87328f2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (add_lint): For no-effect case, also check for
+ Op_push_i. Makes statements consisting of a single constant
+ trigger the warning.
+
2018-05-23 Arnold D. Robbins <arnold@skeeve.com>
* config.guess, config.sub: Updated from GNULIB.
diff --git a/awkgram.c b/awkgram.c
index f56e455f..24915c23 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8348,7 +8348,7 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype)
}
}
- if (ip->opcode == Op_push) { /* run-time warning */
+ if (ip->opcode == Op_push || ip->opcode == Op_push_i) { /* run-time warning */
list_append(list, instruction(Op_lint));
list->lasti->lint_type = linttype;
}
diff --git a/awkgram.y b/awkgram.y
index 672fa9e0..40c5052f 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5920,7 +5920,7 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype)
}
}
- if (ip->opcode == Op_push) { /* run-time warning */
+ if (ip->opcode == Op_push || ip->opcode == Op_push_i) { /* run-time warning */
list_append(list, instruction(Op_lint));
list->lasti->lint_type = linttype;
}
diff --git a/test/ChangeLog b/test/ChangeLog
index 3f22e1ce..a2575200 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2018-05-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * noeffect.awk, noeffect.ok: Updated.
+
2018-05-23 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): Add files for spacere.
diff --git a/test/noeffect.awk b/test/noeffect.awk
index 472c408e..4be76b1e 100644
--- a/test/noeffect.awk
+++ b/test/noeffect.awk
@@ -3,4 +3,8 @@ BEGIN {
s + 1
;;
"s" 1
+ "a"
+ 42
+ q = 42
+ q
}
diff --git a/test/noeffect.ok b/test/noeffect.ok
index 6a0cc752..9778a4bb 100644
--- a/test/noeffect.ok
+++ b/test/noeffect.ok
@@ -3,3 +3,6 @@ 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'
+gawk: noeffect.awk:6: warning: statement has no effect
+gawk: noeffect.awk:7: warning: statement has no effect
+gawk: noeffect.awk:9: warning: statement has no effect