gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, feature/printf-fixes, updated. gawk-4.1.0-5488-gf9bb0


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/printf-fixes, updated. gawk-4.1.0-5488-gf9bb0aa0
Date: Thu, 13 Jun 2024 08:28:36 -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, feature/printf-fixes has been updated
       via  f9bb0aa030a12970ba37c3c0254310344322dbea (commit)
       via  cfb27e08cfff893b9781d3b8ca1c211819396ba2 (commit)
       via  040dc27518e32bbf1fa54d407f3b9f23f6b5cb1f (commit)
      from  f3c36862834aefdf1a5fa0b7264815d19b61aaad (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=f9bb0aa030a12970ba37c3c0254310344322dbea

commit f9bb0aa030a12970ba37c3c0254310344322dbea
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 13 15:28:16 2024 +0300

    Finish off printf fixes.

diff --git a/ChangeLog b/ChangeLog
index d43486fe..264f0e7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-06-13         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * builtin.c (format_tree): Handle a number of corner cases.
+       See tests/printf-corners.awk. Thanks to Maciej W. Rozycki"
+       <macro@redhat.com> for the report.
+       * NEWS: Updated.
+
 2024-06-10         Arnold D. Robbins     <arnold@skeeve.com>
 
        * main.c (nostalgia): Remved function.
diff --git a/NEWS b/NEWS
index 01f25825..257d442f 100644
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,9 @@ Changes from 5.3.0 to 5.3.x
 7. The never-documented --nostalgia option has been removed. It was
    causing bug reports.
 
-8. As usual, there have been several minor code cleanups and bug fixes.
+8. Some corner cases in s/printf were fixed.
+
+9. As usual, there have been several minor code cleanups and bug fixes.
    See the ChangeLog for details.
 
 Changes from 5.2.x to 5.3.0
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 9e63f7f1..3d819829 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2024-06-13         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2024-06-08         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 982b1bbf..d71954ab 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -180,7 +180,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 strsubscript \
+       match4 strsubscript printf-corners \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
@@ -2613,6 +2613,11 @@ strsubscript:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+printf-corners:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=ENU_USA.1252; export GAWKLOCALE; \
diff --git a/test/ChangeLog b/test/ChangeLog
index 004b5c11..42f2cedc 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-13         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): New test: printf-corners.
+       * printf-corners.awk, printf-corners.ok: New files.
+
 2024-06-08         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Gentests: Change `egrep -q' to `egrep -s' for greater portability.
@@ -11,7 +16,7 @@
 
 2024-04-20         Arnold D. Robbins     <arnold@skeeve.com>
 
-       * Makefile.am (EXTRA_DIST): New tests: strsubscript.
+       * Makefile.am (EXTRA_DIST): New test: strsubscript.
        * strsubscript.awk, strsubscript.ok: New files.
 
 2024-02-29         Arnold D. Robbins     <arnold@skeeve.com>
@@ -20,7 +25,7 @@
 
 2024-01-28         Arnold D. Robbins     <arnold@skeeve.com>
 
-       * Makefile.am (EXTRA_DIST): New tests: match4.
+       * Makefile.am (EXTRA_DIST): New test: match4.
        * match4.awk, match4.ok: New files.
 
 2023-12-24         Arnold D. Robbins     <arnold@skeeve.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index a847c02c..17a0a2e4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1066,6 +1066,8 @@ EXTRA_DIST = \
        printfchar.awk \
        printfchar.ok \
        printfloat.awk \
+       printf-corners.awk \
+       printf-corners.ok \
        printhuge.awk \
        printhuge.ok \
        printlang.awk \
@@ -1548,7 +1550,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 strsubscript \
+       match4 strsubscript printf-corners \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
diff --git a/test/Makefile.in b/test/Makefile.in
index f6546082..4e4bfc95 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1330,6 +1330,8 @@ EXTRA_DIST = \
        printfchar.awk \
        printfchar.ok \
        printfloat.awk \
+       printf-corners.awk \
+       printf-corners.ok \
        printhuge.awk \
        printhuge.ok \
        printlang.awk \
@@ -1812,7 +1814,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 strsubscript \
+       match4 strsubscript printf-corners \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
@@ -4429,6 +4431,11 @@ strsubscript:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+printf-corners:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
diff --git a/test/Maketests b/test/Maketests
index 57603040..6da82685 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1298,6 +1298,11 @@ strsubscript:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+printf-corners:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
diff --git a/test/printf-corners.awk b/test/printf-corners.awk
new file mode 100644
index 00000000..0a23d870
--- /dev/null
+++ b/test/printf-corners.awk
@@ -0,0 +1,11 @@
+BEGIN {
+       printf "<%#.2o>\n", 1           # 01
+       printf "<%#.2x>\n", 1           # 0x01
+       printf "<%#.x>\n", 0            # ""
+       printf "<%+.i>\n", 0            # "+"
+       printf "<% .i>\n", 0            # " "
+       printf "<%e>\n", "-nan"         # "-nan"
+       printf "<%e>\n", "inf"          # "inf"
+       printf "<% e>\n", "inf"         # " inf"
+       printf "<%20e>\n", "-inf"       # "                -inf"
+}
diff --git a/test/printf-corners.ok b/test/printf-corners.ok
new file mode 100644
index 00000000..6d485db1
--- /dev/null
+++ b/test/printf-corners.ok
@@ -0,0 +1,9 @@
+<01>
+<0x01>
+<>
+<+>
+< >
+<-nan>
+<0.000000e+00>
+< 0.000000e+00>
+<                -inf>

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

commit cfb27e08cfff893b9781d3b8ca1c211819396ba2
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 13 15:21:53 2024 +0300

    Second fix for MPFR printf.

diff --git a/builtin.c b/builtin.c
index 2cca3cf5..8de3b32c 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1369,6 +1369,9 @@ mpz0:
                                                    && ((zero_flag && ! 
have_prec)
                                                         || (fw == 0 && 
have_prec)));
 
+                               if (base == 8 && have_prec && prec > 0 && ! 
is_zero(arg) && zero_flag)
+                                       alt = false;
+
                                fmt_type = have_prec ? MP_INT_WITH_PREC : 
MP_INT_WITHOUT_PREC;
                                goto fmt0;
 
@@ -1409,6 +1412,9 @@ mpf1:
                                                    && ((zero_flag && ! 
have_prec)
                                                         || (fw == 0 && 
have_prec)));
 
+                               if (base == 8 && have_prec && prec > 0 && ! 
is_zero(arg) && zero_flag)
+                                       alt = false;
+
                                (void) mpfr_get_z(mpzval, mf, MPFR_RNDZ);       
/* convert to GMP integer */
                                fmt_type = have_prec ? MP_INT_WITH_PREC : 
MP_INT_WITHOUT_PREC;
                                zi = mpzval;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=040dc27518e32bbf1fa54d407f3b9f23f6b5cb1f

commit 040dc27518e32bbf1fa54d407f3b9f23f6b5cb1f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 13 14:58:17 2024 +0300

    First fix for MPFR.

diff --git a/builtin.c b/builtin.c
index eb2b6bee..2cca3cf5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1397,7 +1397,7 @@ mpf1:
                                                }
 
                                                tmpval = uval = (uintmax_t) 
mpfr_get_sj(mf, ROUND_MODE);
-                                               if (! alt && have_prec && prec 
== 0 && tmpval == 0)
+                                               if ((! alt || base != 8) && 
have_prec && prec == 0 && tmpval == 0)
                                                        goto pr_tail;   /* 
printf("%.0x", 0) is no characters */
                                                goto int0;
                                        }

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

Summary of changes:
 ChangeLog               |  7 +++++++
 NEWS                    |  4 +++-
 builtin.c               |  8 +++++++-
 pc/ChangeLog            |  4 ++++
 pc/Makefile.tst         |  7 ++++++-
 test/ChangeLog          |  9 +++++++--
 test/Makefile.am        |  4 +++-
 test/Makefile.in        |  9 ++++++++-
 test/Maketests          |  5 +++++
 test/printf-corners.awk | 11 +++++++++++
 test/printf-corners.ok  |  9 +++++++++
 11 files changed, 70 insertions(+), 7 deletions(-)
 create mode 100644 test/printf-corners.awk
 create mode 100644 test/printf-corners.ok


hooks/post-receive
-- 
gawk



reply via email to

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