gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-291


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-2917-gf9ff776
Date: Wed, 7 Feb 2018 14:17:21 -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, gawk-4.2-stable has been updated
       via  f9ff7769b7b38973bf7447b8ca596435ccf77b67 (commit)
      from  9b4b32b5911b9d51643d2efd6c646f17e5214c03 (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=f9ff7769b7b38973bf7447b8ca596435ccf77b67

commit f9ff7769b7b38973bf7447b8ca596435ccf77b67
Author: Andrew J. Schorr <address@hidden>
Date:   Wed Feb 7 14:16:47 2018 -0500

    Fix bug printing +"01" in regular and MPFR mode.

diff --git a/ChangeLog b/ChangeLog
index 4c3b12f..a5fd076 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-02-07         Andrew J. Schorr      <address@hidden>
+
+       Print +"01" should print "1", not "01".
+       * interpret.h (Op_unary_plus): Need to make a new number node that does
+       not contain the original string representation. The logic is copied
+       from Op_unary_minus.
+       * mpfr.c (mpg_interpret): Add new case for Op_unary_plus based on
+       the Op_unary_minus logic. We need a fresh number node that does not
+       contain the string.
+
 2018-01-28         Arnold D. Robbins     <address@hidden>
 
        * config.guess, config.sub: Updated.
diff --git a/interpret.h b/interpret.h
index 2ee6811..96e2c89 100644
--- a/interpret.h
+++ b/interpret.h
@@ -621,6 +621,9 @@ mod:
                case Op_unary_plus:
                        // Force argument to be numeric
                        t1 = TOP_NUMBER();
+                       r = make_number(t1->numbr);
+                       DEREF(t1);
+                       REPLACE(r);
                        break;
 
                case Op_store_sub:
diff --git a/mpfr.c b/mpfr.c
index 1c4a2b9..0c962c6 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -1682,6 +1682,20 @@ mod:
                REPLACE(r);
                break;
 
+       case Op_unary_plus:
+               t1 = TOP_NUMBER();
+               if (is_mpg_float(t1)) {
+                       r = mpg_float();
+                       tval = mpfr_set(r->mpg_numbr, t1->mpg_numbr, 
ROUND_MODE);
+                       IEEE_FMT(r->mpg_numbr, tval);
+               } else {
+                       r = mpg_integer();
+                       mpz_set(r->mpg_i, t1->mpg_i);
+               }
+               DEREF(t1);
+               REPLACE(r);
+               break;
+
        case Op_assign_plus:
        case Op_assign_minus:
        case Op_assign_times:
diff --git a/test/ChangeLog b/test/ChangeLog
index 27817e2..c239ba2 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-07         Andrew J. Schorr     <address@hidden>
+
+       * Makefile.am (uplus, mpfruplus): Add new tests.
+       * uplus.awk, uplus.ok, mpfruplus.ok: New files.
+
 2018-02-05         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (MPFR_TESTS): Sort tests and use backslash
diff --git a/test/Makefile.am b/test/Makefile.am
index e154338..1100cb4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -676,6 +676,7 @@ EXTRA_DIST = \
        mpfrsqrt.ok \
        mpfrstrtonum.awk \
        mpfrstrtonum.ok \
+       mpfruplus.ok \
        mpgforcenum.awk \
        mpgforcenum.ok \
        mtchi18n.awk \
@@ -1176,6 +1177,8 @@ EXTRA_DIST = \
        uparrfs.awk \
        uparrfs.in \
        uparrfs.ok \
+       uplus.awk \
+       uplus.ok \
        valgrind.awk \
        watchpoint1.awk \
        watchpoint1.in \
@@ -1251,7 +1254,7 @@ BASIC_TESTS = \
        splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
        subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 
\
        tradanch tweakfld \
-       uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \
+       uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
        wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
        zero2 zeroe0 zeroflag
 
@@ -1299,7 +1302,7 @@ MACHINE_TESTS = double1 double2 fmtspcl intformat
 
 MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
        mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
-       mpfrstrtonum mpgforcenum
+       mpfrstrtonum mpgforcenum mpfruplus
 
 LOCALE_CHARSET_TESTS = \
        asort asorti backbigs1 backsmalls1 backsmalls2 \
@@ -2123,6 +2126,11 @@ mpfrstrtonum:
        @$(AWK) -M -f "$(srcdir)"/address@hidden > _$@ 2>&1
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+mpfruplus:
+       @echo $@
+       @$(AWK) -M -f "$(srcdir)"/uplus.awk > _$@ 2>&1
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 mpgforcenum:
        @echo $@
        @$(AWK) -M -f "$(srcdir)"/address@hidden > _$@ 2>&1
diff --git a/test/Makefile.in b/test/Makefile.in
index 99047fe..3de436f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -934,6 +934,7 @@ EXTRA_DIST = \
        mpfrsqrt.ok \
        mpfrstrtonum.awk \
        mpfrstrtonum.ok \
+       mpfruplus.ok \
        mpgforcenum.awk \
        mpgforcenum.ok \
        mtchi18n.awk \
@@ -1434,6 +1435,8 @@ EXTRA_DIST = \
        uparrfs.awk \
        uparrfs.in \
        uparrfs.ok \
+       uplus.awk \
+       uplus.ok \
        valgrind.awk \
        watchpoint1.awk \
        watchpoint1.in \
@@ -1508,7 +1511,7 @@ BASIC_TESTS = \
        splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
        subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 
\
        tradanch tweakfld \
-       uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \
+       uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
        wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
        zero2 zeroe0 zeroflag
 
@@ -1552,7 +1555,7 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht
 MACHINE_TESTS = double1 double2 fmtspcl intformat
 MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
        mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
-       mpfrstrtonum mpgforcenum
+       mpfrstrtonum mpgforcenum mpfruplus
 
 LOCALE_CHARSET_TESTS = \
        asort asorti backbigs1 backsmalls1 backsmalls2 \
@@ -2563,6 +2566,11 @@ mpfrstrtonum:
        @$(AWK) -M -f "$(srcdir)"/address@hidden > _$@ 2>&1
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+mpfruplus:
+       @echo $@
+       @$(AWK) -M -f "$(srcdir)"/uplus.awk > _$@ 2>&1
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 mpgforcenum:
        @echo $@
        @$(AWK) -M -f "$(srcdir)"/address@hidden > _$@ 2>&1
@@ -3946,6 +3954,11 @@ uparrfs:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+uplus:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 wjposer1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 314aaae..e449dd3 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1037,6 +1037,11 @@ uparrfs:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+uplus:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 wjposer1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/mpfruplus.ok b/test/mpfruplus.ok
new file mode 100644
index 0000000..9f6e83e
--- /dev/null
+++ b/test/mpfruplus.ok
@@ -0,0 +1,3 @@
+1
+1
+-1
diff --git a/test/uplus.awk b/test/uplus.awk
new file mode 100644
index 0000000..3220f7f
--- /dev/null
+++ b/test/uplus.awk
@@ -0,0 +1,5 @@
+BEGIN {
+   print "01" + 0
+   print +"01"
+   print -"01"
+}
diff --git a/test/uplus.ok b/test/uplus.ok
new file mode 100644
index 0000000..9f6e83e
--- /dev/null
+++ b/test/uplus.ok
@@ -0,0 +1,3 @@
+1
+1
+-1

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

Summary of changes:
 ChangeLog                          | 10 ++++++++++
 interpret.h                        |  3 +++
 mpfr.c                             | 14 ++++++++++++++
 test/ChangeLog                     |  5 +++++
 test/Makefile.am                   | 12 ++++++++++--
 test/Makefile.in                   | 17 +++++++++++++++--
 test/Maketests                     |  5 +++++
 test/{arrayref.ok => mpfruplus.ok} |  1 +
 test/uplus.awk                     |  5 +++++
 test/{arrayref.ok => uplus.ok}     |  1 +
 10 files changed, 69 insertions(+), 4 deletions(-)
 copy test/{arrayref.ok => mpfruplus.ok} (57%)
 create mode 100644 test/uplus.awk
 copy test/{arrayref.ok => uplus.ok} (57%)


hooks/post-receive
-- 
gawk



reply via email to

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