gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, master, updated. gawk-4.1.0-5365-g0a633013


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-5365-g0a633013
Date: Sun, 8 Oct 2023 15:20:35 -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  0a63301382b2afd50bc806d74d3652ce7737a548 (commit)
      from  b03801652b44d3425805ebf2a25f3ab201e85cc3 (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=0a63301382b2afd50bc806d74d3652ce7737a548

commit 0a63301382b2afd50bc806d74d3652ce7737a548
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Oct 8 22:20:10 2023 +0300

    Improve lintplus checking.

diff --git a/ChangeLog b/ChangeLog
index f02d114e..0b69d411 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2023-10-08         Arnold D. Robbins     <arnold@skeeve.com>
 
        * node.c (parse_escape): Fix warning message for \u escape.
+       * interpret.h (Op_lint_plus): Improve the test, especially
+       for if dealing with user intput. Thanks to Hermann Peifer
+       for the report.
 
 2023-10-03         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/interpret.h b/interpret.h
index 9ffa5bbd..4c723ae0 100644
--- a/interpret.h
+++ b/interpret.h
@@ -483,9 +483,10 @@ uninitialized_scalar:
                case Op_lint_plus:
                        // no need to check do_lint, this opcode won't
                        // be generated if that's not true
-                       t1 = TOP();
-                       t2 = PEEK(1);
-                       if ((t1->flags & STRING) != 0 && (t2->flags & STRING) 
!= 0)
+                       t1 = fixtype(TOP());
+                       t2 = fixtype(PEEK(1));
+                       if ((t1->flags & (STRING|USER_INPUT)) == STRING
+                           && (t2->flags & (STRING|USER_INPUT)) == STRING)
                                lintwarn(_("operator `+' used on two string 
values"));
                        break;
 
diff --git a/pc/ChangeLog b/pc/ChangeLog
index a175e294..774d5252 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-10-08         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2023-10-07  Eli Zaretskii  <eliz@gnu.org>
 
        * Makefile (ALL_EXTENSIONS, readdir_test.$(SOEXT)): Remove
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 342a2f8b..8981ed6f 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -208,6 +208,7 @@ GAWK_EXT_TESTS = \
        indirectbuiltin indirectcall indirectcall2 \
        indirectcall3 intarray iolint isarrayunset lint \
        lintexp lintindex lintint lintlength lintold lintplus lintplus2 \
+       lintplus3 \
        lintset lintwarn manyfiles match1 match2 match3 mbstr1 mbstr2 \
        mdim1 mdim2 mdim3 mdim4 mdim5 mdim6 mdim7 mdim8 \
        mixed1 mktime modifiers muldimposix nastyparm negtime \
@@ -257,6 +258,7 @@ NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 dbugeval3 
dbugeval4
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
        defref fmtspcl lintexp lintindex lintint lintlength lintplus lintplus2 \
+       lintplus3 \
        lintwarn noeffect nofmtch nonl shadow uninit2 uninit3 uninit4 \
        uninit5 uninitialized
 
@@ -3126,6 +3128,11 @@ lintplus2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint --pretty-print=_$@ >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+lintplus3:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint < "$(srcdir)"/$@.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 lintset:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index c221e859..3bd65be6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -4,6 +4,11 @@
        for Windows. Thanks to Eli Zaretskii for the tip.
        * cmdlinefsbacknl2.ok: Updated after fix to warning message.
 
+       Unrelated:
+
+       * Makefile.am (EXTRA_DIST): New test, lintplus3.
+       * lintplus3.awk, lintplus3.in, lintplus3.ok: New files.
+
 2023-10-04         Arnold D. Robbins     <arnold@skeeve.com>
 
        * badargs.ok: Update after code changes.
diff --git a/test/Makefile.am b/test/Makefile.am
index e98dc009..323804c8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -699,6 +699,9 @@ EXTRA_DIST = \
        lintplus.ok \
        lintplus2.awk \
        lintplus2.ok \
+       lintplus3.awk \
+       lintplus3.in \
+       lintplus3.ok \
        lintset.awk \
        lintset.ok \
        lintwarn.awk \
@@ -1551,6 +1554,7 @@ GAWK_EXT_TESTS = \
        indirectbuiltin indirectcall indirectcall2 \
        indirectcall3 intarray iolint isarrayunset lint \
        lintexp lintindex lintint lintlength lintold lintplus lintplus2 \
+       lintplus3 \
        lintset lintwarn manyfiles match1 match2 match3 mbstr1 mbstr2 \
        mdim1 mdim2 mdim3 mdim4 mdim5 mdim6 mdim7 mdim8 \
        mixed1 mktime modifiers muldimposix nastyparm negtime \
@@ -1603,6 +1607,7 @@ NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 
dbugeval3 dbugeval4
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
        defref fmtspcl lintexp lintindex lintint lintlength lintplus lintplus2 \
+       lintplus3 \
        lintwarn noeffect nofmtch nonl shadow uninit2 uninit3 uninit4 \
        uninit5 uninitialized
 
diff --git a/test/Makefile.in b/test/Makefile.in
index 77fcea4b..a614e5c9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -963,6 +963,9 @@ EXTRA_DIST = \
        lintplus.ok \
        lintplus2.awk \
        lintplus2.ok \
+       lintplus3.awk \
+       lintplus3.in \
+       lintplus3.ok \
        lintset.awk \
        lintset.ok \
        lintwarn.awk \
@@ -1815,6 +1818,7 @@ GAWK_EXT_TESTS = \
        indirectbuiltin indirectcall indirectcall2 \
        indirectcall3 intarray iolint isarrayunset lint \
        lintexp lintindex lintint lintlength lintold lintplus lintplus2 \
+       lintplus3 \
        lintset lintwarn manyfiles match1 match2 match3 mbstr1 mbstr2 \
        mdim1 mdim2 mdim3 mdim4 mdim5 mdim6 mdim7 mdim8 \
        mixed1 mktime modifiers muldimposix nastyparm negtime \
@@ -1864,6 +1868,7 @@ NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 
dbugeval3 dbugeval4
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
        defref fmtspcl lintexp lintindex lintint lintlength lintplus lintplus2 \
+       lintplus3 \
        lintwarn noeffect nofmtch nonl shadow uninit2 uninit3 uninit4 \
        uninit5 uninitialized
 
@@ -4915,6 +4920,11 @@ lintplus2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint --pretty-print=_$@ >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+lintplus3:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint < "$(srcdir)"/$@.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 lintset:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 9fb59dfa..5df48347 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1804,6 +1804,11 @@ lintplus2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint --pretty-print=_$@ >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+lintplus3:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --lint < "$(srcdir)"/$@.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 lintset:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/lintplus3.awk b/test/lintplus3.awk
new file mode 100644
index 00000000..4309f6d8
--- /dev/null
+++ b/test/lintplus3.awk
@@ -0,0 +1,2 @@
+{print $1 + $2, typeof($1), typeof($2)}
+{print typeof($1), typeof($2), $1 + $2}
diff --git a/test/lintplus3.in b/test/lintplus3.in
new file mode 100644
index 00000000..7884f901
--- /dev/null
+++ b/test/lintplus3.in
@@ -0,0 +1,2 @@
+1 2
+a b
diff --git a/test/lintplus3.ok b/test/lintplus3.ok
new file mode 100644
index 00000000..f02b78f9
--- /dev/null
+++ b/test/lintplus3.ok
@@ -0,0 +1,7 @@
+gawk: lintplus3.awk:1: warning: `typeof' is a gawk extension
+3 strnum strnum
+strnum strnum 3
+gawk: lintplus3.awk:1: (FILENAME=- FNR=2) warning: operator `+' used on two 
string values
+0 string string
+gawk: lintplus3.awk:2: (FILENAME=- FNR=2) warning: operator `+' used on two 
string values
+string string 0

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

Summary of changes:
 ChangeLog                      |  3 +++
 interpret.h                    |  7 ++++---
 pc/ChangeLog                   |  4 ++++
 pc/Makefile.tst                |  7 +++++++
 test/ChangeLog                 |  5 +++++
 test/Makefile.am               |  5 +++++
 test/Makefile.in               | 10 ++++++++++
 test/Maketests                 |  5 +++++
 test/lintplus3.awk             |  2 ++
 test/{fsbs.ok => lintplus3.in} |  1 +
 test/lintplus3.ok              |  7 +++++++
 11 files changed, 53 insertions(+), 3 deletions(-)
 create mode 100644 test/lintplus3.awk
 copy test/{fsbs.ok => lintplus3.in} (50%)
 create mode 100644 test/lintplus3.ok


hooks/post-receive
-- 
gawk



reply via email to

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