[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4182-g3b50111
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4182-g3b50111 |
Date: |
Sat, 19 Dec 2020 15:09:19 -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-5.1-stable has been updated
via 3b50111ac31a64e01a2e64a06c7c276f6b9424cf (commit)
from 8224cc546f7cfb0922fb69f3ad3f91313cf80e37 (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=3b50111ac31a64e01a2e64a06c7c276f6b9424cf
commit 3b50111ac31a64e01a2e64a06c7c276f6b9424cf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sat Dec 19 22:08:43 2020 +0200
First steps fixing +inform, +nancy.
diff --git a/ChangeLog b/ChangeLog
index 5caf828..26ad3f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-12-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ First steps fixing +inform, +nancy. Sigh.
+
+ * awk.h (is_ieee_magic_val): Add declaration.
+ * node.c (is_ieee_magic_val): Make extern, not static.
+ (r_force_number): Make the check smarter, catch -nan.
+
2020-11-02 Arnold D. Robbins <arnold@skeeve.com>
* re.c (make_regexp): Cast len parameter to int to avoid
diff --git a/awk.h b/awk.h
index cf06d49..23b1564 100644
--- a/awk.h
+++ b/awk.h
@@ -1721,6 +1721,7 @@ extern void init_btowc_cache();
#define is_valid_character(b) (btowc_cache[(b)&0xFF] != WEOF)
extern bool out_of_range(NODE *n);
extern char *format_nan_inf(NODE *n, char format);
+extern bool is_ieee_magic_val(const char *val);
/* re.c */
extern Regexp *make_regexp(const char *s, size_t len, bool ignorecase, bool
dfa, bool canfatal);
extern int research(Regexp *rp, char *str, int start, size_t len, int flags);
diff --git a/node.c b/node.c
index 707d106..e5ecff1 100644
--- a/node.c
+++ b/node.c
@@ -28,7 +28,6 @@
#include "math.h"
#include "floatmagic.h" /* definition of isnan */
-static int is_ieee_magic_val(const char *val);
static NODE *r_make_number(double x);
static AWKNUM get_ieee_magic_val(char *val);
extern NODE **fmt_list; /* declared in eval.c */
@@ -101,9 +100,12 @@ r_force_number(NODE *n)
if (! do_posix) {
if (is_alpha((unsigned char) *cp))
goto badnum;
- else if (cpend == cp+4 && is_ieee_magic_val(cp)) {
- n->numbr = get_ieee_magic_val(cp);
- goto goodnum;
+ else if (is_ieee_magic_val(cp)) {
+ if (cpend == cp + 4) {
+ n->numbr = get_ieee_magic_val(cp);
+ goto goodnum;
+ } else
+ goto badnum;
}
/* else
fall through */
@@ -165,6 +167,9 @@ badnum:
return n;
goodnum:
+ if (isnan(n->numbr) && *cp == '-' && signbit(n->numbr) == 0)
+ n->numbr = -(n->numbr);
+
if ((n->flags & USER_INPUT) != 0) {
/* leave USER_INPUT enabled to indicate that this is a strnum */
n->flags &= ~STRING;
@@ -959,7 +964,7 @@ out: ;
/* is_ieee_magic_val --- return true for +inf, -inf, +nan, -nan */
-static int
+bool
is_ieee_magic_val(const char *val)
{
/*
diff --git a/pc/ChangeLog b/pc/ChangeLog
index fe1a53d..d8df9a3 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2020-12-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Rebuilt.
+
2020-11-01 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Rebuilt.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 318a5b6..96902d9 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -203,7 +203,8 @@ GAWK_EXT_TESTS = \
genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind
\
icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase incdupe \
incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \
- indirectbuiltin indirectcall indirectcall2 intarray iolint isarrayunset
\
+ indirectbuiltin indirectcall indirectcall2 inf-nan-torture \
+ intarray iolint isarrayunset \
lint lintexp lintindex lintint lintlength lintplus lintold lintset
lintwarn \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
@@ -2883,6 +2884,11 @@ indirectcall2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$?
>>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+inf-nan-torture:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
intarray:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index 3817087..48f28ed 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): inf-nan-torture, new test.
+ * inf-nan-torture.awk, inf-nan-torture.in, inf-nan-torture.ok: New
+ files.
+
2020-10-29 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): functab5, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index aebdf83..278a0eb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -563,6 +563,9 @@ EXTRA_DIST = \
indirectcall.awk \
indirectcall.in \
indirectcall.ok \
+ inf-nan-torture.awk \
+ inf-nan-torture.in \
+ inf-nan-torture.ok \
inftest.awk \
inftest.ok \
inplace1.1.ok \
@@ -1428,7 +1431,8 @@ GAWK_EXT_TESTS = \
genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind
\
icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase incdupe \
incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \
- indirectbuiltin indirectcall indirectcall2 intarray iolint isarrayunset
\
+ indirectbuiltin indirectcall indirectcall2 inf-nan-torture \
+ intarray iolint isarrayunset \
lint lintexp lintindex lintint lintlength lintplus lintold lintset
lintwarn \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
diff --git a/test/Makefile.in b/test/Makefile.in
index bed55b9..e0528b9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -826,6 +826,9 @@ EXTRA_DIST = \
indirectcall.awk \
indirectcall.in \
indirectcall.ok \
+ inf-nan-torture.awk \
+ inf-nan-torture.in \
+ inf-nan-torture.ok \
inftest.awk \
inftest.ok \
inplace1.1.ok \
@@ -1691,7 +1694,8 @@ GAWK_EXT_TESTS = \
genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind
\
icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase incdupe \
incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \
- indirectbuiltin indirectcall indirectcall2 intarray iolint isarrayunset
\
+ indirectbuiltin indirectcall indirectcall2 inf-nan-torture \
+ intarray iolint isarrayunset \
lint lintexp lintindex lintint lintlength lintplus lintold lintset
lintwarn \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \
nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \
@@ -4536,6 +4540,11 @@ indirectcall2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$?
>>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+inf-nan-torture:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
intarray:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 7fc7d87..d849f54 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1624,6 +1624,11 @@ indirectcall2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$?
>>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+inf-nan-torture:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
intarray:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 ||
echo EXIT CODE: $$? >>_$@
diff --git a/test/inf-nan-torture.awk b/test/inf-nan-torture.awk
new file mode 100644
index 0000000..8d145f2
--- /dev/null
+++ b/test/inf-nan-torture.awk
@@ -0,0 +1,4 @@
+{
+ for (i = 1; i <= NF; i++)
+ print i, $i, $i + 0
+}
diff --git a/test/inf-nan-torture.in b/test/inf-nan-torture.in
new file mode 100644
index 0000000..45dfdc8
--- /dev/null
+++ b/test/inf-nan-torture.in
@@ -0,0 +1 @@
+-inf -inform inform -nan -nancy nancy -123 0 123 +123 nancy +nancy +nan inform
+inform +inf
diff --git a/test/inf-nan-torture.ok b/test/inf-nan-torture.ok
new file mode 100644
index 0000000..40d3194
--- /dev/null
+++ b/test/inf-nan-torture.ok
@@ -0,0 +1,16 @@
+1 -inf -inf
+2 -inform 0
+3 inform 0
+4 -nan -nan
+5 -nancy 0
+6 nancy 0
+7 -123 -123
+8 0 0
+9 123 123
+10 +123 123
+11 nancy 0
+12 +nancy 0
+13 +nan +nan
+14 inform 0
+15 +inform 0
+16 +inf +inf
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
awk.h | 1 +
node.c | 15 ++++++++++-----
pc/ChangeLog | 4 ++++
pc/Makefile.tst | 8 +++++++-
test/ChangeLog | 6 ++++++
test/Makefile.am | 6 +++++-
test/Makefile.in | 11 ++++++++++-
test/Maketests | 5 +++++
test/inf-nan-torture.awk | 4 ++++
test/inf-nan-torture.in | 1 +
test/inf-nan-torture.ok | 16 ++++++++++++++++
12 files changed, 77 insertions(+), 8 deletions(-)
create mode 100644 test/inf-nan-torture.awk
create mode 100644 test/inf-nan-torture.in
create mode 100644 test/inf-nan-torture.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4182-g3b50111,
Arnold Robbins <=