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-2433-g4ce031


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2433-g4ce031a
Date: Fri, 17 Feb 2017 01:19:18 -0500 (EST)

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  4ce031ad3c3d157a425f721688a09a7dde018619 (commit)
      from  eb8d0c64228657bad4ef2e2fd732eeed937f3af1 (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=4ce031ad3c3d157a425f721688a09a7dde018619

commit 4ce031ad3c3d157a425f721688a09a7dde018619
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Feb 17 08:18:51 2017 +0200

    Fix typeof on null fields.

diff --git a/ChangeLog b/ChangeLog
index cb9a011..f62bef9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-17         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_typeof): Handle arguments that have
+       the NULL_FIELD flag set.
+
 2017-02-03         Andrew J. Schorr     <address@hidden>
 
        * awkgram.y (set_profile_text): Improve code clarity by using emalloc
diff --git a/builtin.c b/builtin.c
index f410476..394319b 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3977,7 +3977,7 @@ NODE *
 do_typeof(int nargs)
 {
        NODE *arg;
-       char *res = "unknown";
+       char *res = NULL;
        bool deref = true;
 
        arg = POP();
@@ -3989,9 +3989,6 @@ do_typeof(int nargs)
                break;
        case Node_val:
                switch (fixtype(arg)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) 
{
-               case STRING:
-                       res = "string";
-                       break;
                case NUMBER:
                        res = "number";
                        break;
@@ -4001,14 +3998,20 @@ do_typeof(int nargs)
                case REGEX:
                        res = "regexp";
                        break;
+               case STRING:
+                       res = "string";
+                       // fall through
                case NUMBER|STRING:
-                       if (arg == Nnull_string) {
+                       if (arg == Nnull_string || (arg->flags & NULL_FIELD) != 
0) {
                                res = "unassigned";
                                break;
                        }
                        /* fall through */
                default:
-                       warning(_("typeof detected invalid flags combination 
`%s'; please file a bug report."), flags2str(arg->flags));
+                       if (res == NULL) {
+                               warning(_("typeof detected invalid flags 
combination `%s'; please file a bug report."), flags2str(arg->flags));
+                               res = "unknown";
+                       }
                        break;
                }
                break;
diff --git a/test/ChangeLog b/test/ChangeLog
index 3566cce..fc7358e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-17         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (typeof5): New test.
+       * typeof5.awk, typeof5.in, typeof5.ok: New files.
+       Thanks to Andrew Schorr for part of the tests.
+
 2017-01-27         Andrew J. Schorr     <address@hidden>
 
        * Makefile.am (gensub3): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 9f79df8..7715c39 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1110,6 +1110,9 @@ EXTRA_DIST = \
        typeof3.ok \
        typeof4.awk \
        typeof4.ok \
+       typeof5.awk \
+       typeof5.in \
+       typeof5.ok \
        uninit2.awk \
        uninit2.ok \
        uninit3.awk \
@@ -1234,7 +1237,8 @@ GAWK_EXT_TESTS = \
        splitarg4 strftime \
        strtonum strtonum1 switch2 symtab1 symtab2 symtab3 symtab4 symtab5 
symtab6 \
        symtab7 symtab8 symtab9 symtab10 \
-       typedregex1 typedregex2 typedregex3 typeof1 typeof2 typeof3 typeof4 \
+       typedregex1 typedregex2 typedregex3 \
+       typeof1 typeof2 typeof3 typeof4 typeof5 \
        timeout \
        watchpoint1
 
diff --git a/test/Makefile.in b/test/Makefile.in
index 1cd8bf1..88b731b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1368,6 +1368,9 @@ EXTRA_DIST = \
        typeof3.ok \
        typeof4.awk \
        typeof4.ok \
+       typeof5.awk \
+       typeof5.in \
+       typeof5.ok \
        uninit2.awk \
        uninit2.ok \
        uninit3.awk \
@@ -1491,7 +1494,8 @@ GAWK_EXT_TESTS = \
        splitarg4 strftime \
        strtonum strtonum1 switch2 symtab1 symtab2 symtab3 symtab4 symtab5 
symtab6 \
        symtab7 symtab8 symtab9 symtab10 \
-       typedregex1 typedregex2 typedregex3 typeof1 typeof2 typeof3 typeof4 \
+       typedregex1 typedregex2 typedregex3 \
+       typeof1 typeof2 typeof3 typeof4 typeof5 \
        timeout \
        watchpoint1
 
@@ -4331,6 +4335,11 @@ typeof4:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+typeof5:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 timeout:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 30211d6..8ae7152 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1527,6 +1527,11 @@ typeof4:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+typeof5:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 timeout:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/typeof5.awk b/test/typeof5.awk
new file mode 100644
index 0000000..30cd6ac
--- /dev/null
+++ b/test/typeof5.awk
@@ -0,0 +1,10 @@
+BEGIN {
+       print typeof($0)
+       print typeof($1)
+}
+
+{
+       $3 = $1
+       print typeof($2)
+       print typeof($3)
+}
diff --git a/test/typeof5.in b/test/typeof5.in
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/test/typeof5.in
@@ -0,0 +1 @@
+test
diff --git a/test/typeof5.ok b/test/typeof5.ok
new file mode 100644
index 0000000..80f8cf5
--- /dev/null
+++ b/test/typeof5.ok
@@ -0,0 +1,4 @@
+unassigned
+unassigned
+unassigned
+string

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

Summary of changes:
 ChangeLog                         |  5 +++++
 builtin.c                         | 15 +++++++++------
 test/ChangeLog                    |  6 ++++++
 test/Makefile.am                  |  6 +++++-
 test/Makefile.in                  | 11 ++++++++++-
 test/Maketests                    |  5 +++++
 test/typeof5.awk                  | 10 ++++++++++
 test/{clos1way2.in => typeof5.in} |  0
 test/typeof5.ok                   |  4 ++++
 9 files changed, 54 insertions(+), 8 deletions(-)
 create mode 100644 test/typeof5.awk
 copy test/{clos1way2.in => typeof5.in} (100%)
 create mode 100644 test/typeof5.ok


hooks/post-receive
-- 
gawk



reply via email to

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