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-3869-g357e542


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-3869-g357e542
Date: Sun, 19 Jan 2020 13:54:13 -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  357e542e5bba9e85a335d9cb17e4a5d666b79a74 (commit)
       via  15db23b88c2866ed900177cbf11ce37e373e5e20 (commit)
      from  49125fbf794508efdb71a4f6f18a4bc324bd76ab (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=357e542e5bba9e85a335d9cb17e4a5d666b79a74

commit 357e542e5bba9e85a335d9cb17e4a5d666b79a74
Merge: 15db23b 49125fb
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Jan 19 20:54:05 2020 +0200

    Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gawk

diff --cc ChangeLog
index d193680,55988b5..b1b2943
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,9 -1,9 +1,15 @@@
 +2020-01-19         Arnold D. Robbins     <address@hidden>
 +
 +      * profile.c (pp_top): New macro.
 +      (pprint): Be smarter for print[f] with redirection that was
 +      parenthesized, to not print `printf(("hello\n")) > "..."'.
 +
+ 2020-01-14         Andrew J. Schorr      <address@hidden>
+ 
+       * cint_array.c (cint_array_init): Fix off-by-one error in array 
+       bounds overflow check for an NHAT value set in the environment.
+       Thanks to Michael Builov <address@hidden> for the report.
+ 
  2020-01-08         Arnold D. Robbins     <address@hidden>
  
        Fix a number of subtle memory leaks. Thanks to the

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=15db23b88c2866ed900177cbf11ce37e373e5e20

commit 15db23b88c2866ed900177cbf11ce37e373e5e20
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Jan 19 20:52:46 2020 +0200

    Fix a pretty-printer error with print[f].

diff --git a/ChangeLog b/ChangeLog
index 0c2d928..d193680 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-19         Arnold D. Robbins     <address@hidden>
+
+       * profile.c (pp_top): New macro.
+       (pprint): Be smarter for print[f] with redirection that was
+       parenthesized, to not print `printf(("hello\n")) > "..."'.
+
 2020-01-08         Arnold D. Robbins     <address@hidden>
 
        Fix a number of subtle memory leaks. Thanks to the
@@ -18,7 +24,7 @@
 
        * interpret.h (Op_subscript): When retrieving from SYMTAB, check
        for Node_var_new; variables can exist but have not been assigned
-       a value.
+       a value. Thanks to Denis Shirokov <address@hidden> for the report.
 
        Unrelated:
 
diff --git a/profile.c b/profile.c
index 8cc19f1..d464c30 100644
--- a/profile.c
+++ b/profile.c
@@ -196,6 +196,10 @@ pp_pop()
        return n;
 }
 
+/* pp_top --- look at what's on the top of the stack */
+
+#define pp_top()       pp_stack
+
 /* pp_free --- release a pretty printed node */
 
 static void
@@ -665,9 +669,20 @@ cleanup:
                        if (pc->opcode == Op_K_print_rec)
                                // instead of `print $0', just `print'
                                tmp = strdup("");
-                       else if (pc->redir_type != 0)
-                               tmp = pp_list(pc->expr_count, "()", ", ");
-                       else {
+                       else if (pc->redir_type != 0) {
+                               // Avoid turning printf("hello\n") into 
printf(("hello\n"))
+                               NODE *n = pp_top();
+
+                               if (pc->expr_count == 1
+                                   && n->pp_str[0] == '(' 
+                                   && n->pp_str[n->pp_len - 1] == ')') {
+                                       n = pp_pop();
+
+                                       tmp = strdup(n->pp_str);
+                                       pp_free(n);
+                               } else
+                                       tmp = pp_list(pc->expr_count, "()", ", 
");
+                       } else {
                                tmp = pp_list(pc->expr_count, "  ", ", ");
                                tmp[strlen(tmp) - 1] = '\0';    /* remove 
trailing space */
                        }
diff --git a/test/ChangeLog b/test/ChangeLog
index 3047003..c188931 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-19         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (EXTRA_DIST): New test, profile13.
+       * profile13.awk, profile13.ok: New files.
+       * profile5.ok: Updated after code changes.
+
 2020-01-08         Arnold D. Robbins     <address@hidden>
 
        * indirectbuiltin.awk, numrange.awk, numrange.ok: Changes
diff --git a/test/Makefile.am b/test/Makefile.am
index aa64110..bf77ea3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -961,6 +961,8 @@ EXTRA_DIST = \
        profile12.awk \
        profile12.in \
        profile12.ok \
+       profile13.awk \
+       profile13.ok \
        prt1eval.awk \
        prt1eval.ok \
        prtoeval.awk \
@@ -1393,7 +1395,7 @@ GAWK_EXT_TESTS = \
        nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 
nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
        procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 
\
-       profile7 profile8 profile9 profile10 profile11 profile12 pty1 pty2 \
+       profile7 profile8 profile9 profile10 profile11 profile12 profile13 pty1 
pty2 \
        rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline 
rsglstdin \
        rsstart1 rsstart2 rsstart3 rstest6 \
        sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \
@@ -1455,7 +1457,7 @@ NEED_POSIX = escapebrace printf0 posix2008sub 
paramasfunc1 paramasfunc2 muldimpo
 
 # List of tests that need --pretty-print
 NEED_PRETTY = nsprof1 nsprof2 \
-       profile4 profile5 profile8 profile9 profile10 profile11
+       profile4 profile5 profile8 profile9 profile10 profile11 profile13
 
 # List of tests that need --re-interval
 NEED_RE_INTERVAL = gsubtst3 reint reint2
diff --git a/test/Makefile.in b/test/Makefile.in
index 9557b1e..0794b3b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1220,6 +1220,8 @@ EXTRA_DIST = \
        profile12.awk \
        profile12.in \
        profile12.ok \
+       profile13.awk \
+       profile13.ok \
        prt1eval.awk \
        prt1eval.ok \
        prtoeval.awk \
@@ -1652,7 +1654,7 @@ GAWK_EXT_TESTS = \
        nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 nsindirect2 nsprof1 
nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \
        procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 
\
-       profile7 profile8 profile9 profile10 profile11 profile12 pty1 pty2 \
+       profile7 profile8 profile9 profile10 profile11 profile12 profile13 pty1 
pty2 \
        rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline 
rsglstdin \
        rsstart1 rsstart2 rsstart3 rstest6 \
        sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \
@@ -1713,7 +1715,7 @@ NEED_POSIX = escapebrace printf0 posix2008sub 
paramasfunc1 paramasfunc2 muldimpo
 
 # List of tests that need --pretty-print
 NEED_PRETTY = nsprof1 nsprof2 \
-       profile4 profile5 profile8 profile9 profile10 profile11
+       profile4 profile5 profile8 profile9 profile10 profile11 profile13
 
 
 # List of tests that need --re-interval
@@ -4657,6 +4659,11 @@ profile11:
        @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --pretty-print=_$@ >_$@ 2>&1 || 
echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+profile13:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --pretty-print=_$@ >_$@ 2>&1 || 
echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 regnul1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? 
>>_$@
diff --git a/test/Maketests b/test/Maketests
index e339b2b..d8c3299 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1810,6 +1810,11 @@ profile11:
        @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --pretty-print=_$@ >_$@ 2>&1 || 
echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+profile13:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  --pretty-print=_$@ >_$@ 2>&1 || 
echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 regnul1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? 
>>_$@
diff --git a/test/profile13.awk b/test/profile13.awk
new file mode 100644
index 0000000..dc090ae
--- /dev/null
+++ b/test/profile13.awk
@@ -0,0 +1,4 @@
+BEGIN {
+       printf "hello\n"  > "/dev/stderr"
+       printf("hello\n") > "/dev/stderr"
+}
diff --git a/test/profile13.ok b/test/profile13.ok
new file mode 100644
index 0000000..258238a
--- /dev/null
+++ b/test/profile13.ok
@@ -0,0 +1,5 @@
+BEGIN {
+       printf("hello\n") > "/dev/stderr"
+       printf("hello\n") > "/dev/stderr"
+}
+
diff --git a/test/profile5.ok b/test/profile5.ok
index 1b32ced..309ec1e 100644
--- a/test/profile5.ok
+++ b/test/profile5.ok
@@ -1680,14 +1680,14 @@ function _con(t, ts, a, b, c, d, i, r, A, B)
                        if ((i = length(t = _tabtospc(A[1], ts, _conlastrln))) 
< _constatstrln) {
                                t = t _getchrln(" ", _constatstrln - i)
                        }
-                       print((t B[1])) > _SYS_STDCON
+                       print(t B[1]) > _SYS_STDCON
                        for (i = 2; i < c; i++) {
-                               print((_tabtospc(A[i], ts) B[i])) > _SYS_STDCON
+                               print(_tabtospc(A[i], ts) B[i]) > _SYS_STDCON
                        }
-                       print((_conlastr = _tabtospc(A[c], ts))) > _SYS_STDCON
+                       print(_conlastr = _tabtospc(A[c], ts)) > _SYS_STDCON
                        fflush(_SYS_STDCON)
                } else {
-                       print((t = _tabtospc(t, ts, _conlastrln))) > _SYS_STDCON
+                       print(t = _tabtospc(t, ts, _conlastrln)) > _SYS_STDCON
                        fflush(_SYS_STDCON)
                        _conlastr = _conlastr t
                }
@@ -1696,7 +1696,7 @@ function _con(t, ts, a, b, c, d, i, r, A, B)
                }
                _conlastrln = length(_conlastr)
                if (_constatstr) {
-                       print(((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - 
_conlastrln)) _CHR["CR"] _conlastr)) > _SYS_STDCON
+                       print((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - 
_conlastrln)) _CHR["CR"] _conlastr) > _SYS_STDCON
                        fflush(_SYS_STDCON)
                        _constatstrln = length(t)
                }
@@ -1763,7 +1763,7 @@ function _constat(t, ts, ln, a)
        a = BINMODE
        BINMODE = "rw"
        ORS = ""
-       print((t _CHR["CR"] _conlastr)) > _SYS_STDCON
+       print(t _CHR["CR"] _conlastr) > _SYS_STDCON
        fflush(_SYS_STDCON)
        ORS = ln
        BINMODE = a

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

Summary of changes:
 ChangeLog          |  8 +++++++-
 profile.c          | 21 ++++++++++++++++++---
 test/ChangeLog     |  6 ++++++
 test/Makefile.am   |  6 ++++--
 test/Makefile.in   | 11 +++++++++--
 test/Maketests     |  5 +++++
 test/profile13.awk |  4 ++++
 test/profile13.ok  |  5 +++++
 test/profile5.ok   | 12 ++++++------
 9 files changed, 64 insertions(+), 14 deletions(-)
 create mode 100644 test/profile13.awk
 create mode 100644 test/profile13.ok


hooks/post-receive
-- 
gawk



reply via email to

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