[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1943-gfeb11c
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1943-gfeb11c0 |
Date: |
Sun, 14 Aug 2016 13:56:14 +0000 (UTC) |
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 feb11c09caa22207cbf53bf7cfcdeca42d661b8b (commit)
via 5ce09ba3867f5c9d3c3dc0c00c155c0ba0c224f6 (commit)
via 1e83ff34fa8a4a80e486169f24519864480320f4 (commit)
via dcb6d54b3c272a7c8f0efadb7fad215e39248cad (commit)
via 1c972b5c234fb031f62356706cd8c0336312833d (commit)
via 3cf67f58ce8e42f9ce8d7be45936eedf79751b46 (commit)
via 560cf6d52f978e360e9b2a10f7ddd9a0197e0b31 (commit)
from 6783818342eab9c372c5eb1e9187ab1ae9dd37b5 (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=feb11c09caa22207cbf53bf7cfcdeca42d661b8b
commit feb11c09caa22207cbf53bf7cfcdeca42d661b8b
Author: Arnold D. Robbins <address@hidden>
Date: Sun Aug 14 16:55:56 2016 +0300
Update intarray test and ok files.
diff --git a/test/ChangeLog b/test/ChangeLog
index 1736757..dbac66e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-14 Andrew J. Schorr <address@hidden>
+
+ * intarray.awk, intarray.ok: Updated.
+
2016-08-03 Arnold D. Robbins <address@hidden>
Remove typed regexes until they can be done correctly.
diff --git a/test/intarray.awk b/test/intarray.awk
index 2c30bd5..8785ea9 100644
--- a/test/intarray.awk
+++ b/test/intarray.awk
@@ -1,10 +1,19 @@
BEGIN {
- nf = split("5 |05|0x4|00| 5|-0x12| 011|-013", f, "|")
+ nf = split("5 |05|0x4|00| 5|-0x12| 011|-013|1.0|5.1e1|-5|-05|+2", f,
"|")
for (i = 1; i <= nf; i++) {
delete g
+ g[f[i]]
+ for (x in g) {
+ if (x"" != f[i]"")
+ printf "Error in string test: [%s] != [%s]\n",
x, f[i]
+ }
+
+ delete g
z = f[i]+0 # trigger numeric conversion
g[f[i]]
- for (x in g)
- printf "[%s]\n", x
+ for (x in g) {
+ if (x"" != f[i]"")
+ printf "Error in strnum test: [%s] != [%s]\n",
x, f[i]
+ }
}
}
diff --git a/test/intarray.ok b/test/intarray.ok
index d4df7b8..e69de29 100644
--- a/test/intarray.ok
+++ b/test/intarray.ok
@@ -1,8 +0,0 @@
-[5 ]
-[05]
-[0x4]
-[00]
-[ 5]
-[-0x12]
-[ 011]
-[-013]
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5ce09ba3867f5c9d3c3dc0c00c155c0ba0c224f6
commit 5ce09ba3867f5c9d3c3dc0c00c155c0ba0c224f6
Merge: 6783818 1e83ff3
Author: Arnold D. Robbins <address@hidden>
Date: Fri Aug 12 11:54:57 2016 +0300
Merge branch 'gawk-4.1-stable'
diff --cc ChangeLog
index 3287d8b,f218714..a8aed23
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,25 -1,23 +1,45 @@@
+ 2016-08-12 Arnold D. Robbins <address@hidden>
+
+ * dfa.c: Sync with GNU grep.
+
+ Unrelated:
+
+ * int_array.c: Minor text and formatting edits.
+
+ 2016-08-09 Andrew J. Schorr <address@hidden>
+
+ * awk.h: Add a comment explaining the NUMINT flag in more detail.
+ * int_array.c (standard_integer_string): New function to test whether
+ a string matches what would be produced by sprintf("%ld", <value>).
+ (is_integer): Fix bug -- if NUMBER was set, then the function was
+ accepting strnum values with nonstandard string representations. We
+ now call standard_integer_string to check that the string looks OK.
+ Also added ifdef'ed code to simplify the function by relying upon
+ force_number to parse the string, but this is disabled due to possible
+ negative performance impact.
+
+2016-08-03 Arnold D. Robbins <address@hidden>
+
+ Remove typed regexes until they can be done properly.
+
+ * NEWS: Updated.
+ * awk.h (enum nodevals): Remove Node_typedregex.
+ (force_string, force_number): Remove check for Node_typedregex.
+ * awkgram.y (TYPED_REGEXP): Remove token.
+ (grammar): Remove productions related to typed regexps.
+ (yylex): Don't find a typed regex or return it.
+ (valinfo): Remove code for Node_typedregex.
+ * builtin.c (do_length, do_print, call_sub, call_match,
+ call_split_func, do_typeof): Remove code for Node_typedregex.
+ * debug.c (watchpoint_triggered, print_memory): Remove code
+ for Node_typedregex.
+ * eval.c (nodetypes, setup_frame): Remove code for Node_typedregex.
+ * interpret.h (r_interpret): Remove code for Node_typedregex.
+ * profile.c (pprint): Remove code for Node_typedregex.
+ (pp_strong_regex): Removed.
+ (pp_string_or_strong_regex): Remove code for Node_typedregex.
+ * re.c (re_update): Remove code for Node_typedregex.
+
2016-08-01 Arnold D. Robbins <address@hidden>
* README, NEWS: Mark DJGPP port as unsupported.
diff --cc int_array.c
index e7913de,6cffec8..38b4943
--- a/int_array.c
+++ b/int_array.c
@@@ -89,35 -125,40 +125,62 @@@ is_integer(NODE *symbol, NODE *subs
if (subs == Nnull_string || do_mpfr)
return NULL;
+ /*
+ * Protect against MAYBE_NUM values where the string may not regenerate
+ * correctly. There could be white space and/or a non-decimal value.
+ * If stfmt is not STFMT_UNUSED, it means that the string value was
+ * generated using CONVFMT or OFMT, so there is no info there.
+ */
+ if ((subs->flags & STRCUR) != 0 && subs->stfmt == STFMT_UNUSED) {
+ char *cp = subs->stptr;
+
+ if ( subs->stlen == 0
+ || cp[0] == '0'
+ || isspace((unsigned char) cp[0])
+ || isspace((unsigned char) cp[subs->stlen - 1])
+ || ( subs->stlen >= 2
+ && (cp[0] == '-' || cp[0] == '+')
+ && cp[1] == '0'))
+ return NULL;
+ }
+
+ if ((subs->flags & NUMINT) != 0)
+ return & success_node;
+
- if ((subs->flags & NUMBER) != 0) {
+ #ifdef CHECK_INTEGER_USING_FORCE_NUMBER
+ /*
+ * This approach is much simpler, because we remove all of the strtol
+ * logic below. But this may be slower in some usage cases.
+ */
+ if ((subs->flags & NUMCUR) == 0) {
+ str2number(subs);
+
+ /* check again in case force_number set NUMINT */
+ if ((subs->flags & NUMINT) != 0)
+ return & success_node;
+ }
+ #else /* CHECK_INTEGER_USING_FORCE_NUMBER */
+ if ((subs->flags & NUMCUR) != 0) {
+ #endif /* CHECK_INTEGER_USING_FORCE_NUMBER */
d = subs->numbr;
if (d <= INT32_MAX && d >= INT32_MIN && d == (int32_t) d) {
- subs->flags |= NUMINT;
- return & success_node;
+ /*
+ * The numeric value is an integer, but we must
+ * protect against strings that cannot be generated
+ * from sprintf("%ld", <subscript>). This can happen
+ * with strnum or string values. We could skip this
+ * check for pure NUMBER values, but unfortunately the
+ * code does not currently distinguish between NUMBER
+ * and strnum values.
+ */
+ if ( (subs->flags & STRCUR) == 0
+ || standard_integer_string(subs->stptr,
subs->stlen)) {
+ subs->flags |= NUMINT;
+ return & success_node;
+ }
}
return NULL;
+ #ifndef CHECK_INTEGER_USING_FORCE_NUMBER
}
/* a[3]=1; print "3" in a -- true
@@@ -126,52 -167,51 +189,53 @@@
* a[-3]=1; print "-3" in a -- true
*/
- if ((subs->flags & (STRING|STRCUR)) != 0) {
- char *cp = subs->stptr, *cpend, *ptr;
- char save;
- size_t len = subs->stlen;
-
- if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-'))
- return NULL;
- if (len > 1 &&
- ((*cp == '0') /* "00", "011" .. */
- || (*cp == '-' && *(cp + 1) == '0') /*
"-0", "-011" .. */
- )
- )
- return NULL;
- if (len == 1 && *cp != '-') { /* single digit */
- subs->numbr = (long) (*cp - '0');
- if ((subs->flags & MAYBE_NUM) != 0) {
- subs->flags &= ~MAYBE_NUM;
- subs->flags |= NUMBER;
- }
- subs->flags |= (NUMCUR|NUMINT);
- return & success_node;
- }
+ /* must be a STRING */
+ char *cp = subs->stptr, *cpend, *ptr;
+ char save;
+ size_t len = subs->stlen;
- cpend = cp + len;
- save = *cpend;
- *cpend = '\0';
+ if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-'))
+ return NULL;
- errno = 0;
- l = strtol(cp, & ptr, 10);
- *cpend = save;
- if (errno != 0 || ptr != cpend)
- return NULL;
- subs->numbr = l;
+ if (len > 1 &&
+ ((*cp == '0') /* "00", "011" .. */
+ || (*cp == '-' && *(cp + 1) == '0') /* "-0", "-011"
.. */
+ )
+ )
+ return NULL;
+ if (len == 1 && *cp != '-') { /* single digit */
+ subs->numbr = (long) (*cp - '0');
if ((subs->flags & MAYBE_NUM) != 0) {
- subs->flags &= ~MAYBE_NUM;
+ subs->flags &= ~(MAYBE_NUM|STRING);
subs->flags |= NUMBER;
}
- subs->flags |= NUMCUR;
- if (l <= INT32_MAX && l >= INT32_MIN) {
- subs->flags |= NUMINT;
- return & success_node;
- }
+ subs->flags |= (NUMCUR|NUMINT);
+ return & success_node;
}
+
+ cpend = cp + len;
+ save = *cpend;
+ *cpend = '\0';
+
+ errno = 0;
+ l = strtol(cp, & ptr, 10);
+ *cpend = save;
+ if (errno != 0 || ptr != cpend)
+ return NULL;
+
+ subs->numbr = l;
+ if ((subs->flags & MAYBE_NUM) != 0) {
+ subs->flags &= ~(MAYBE_NUM|STRING);
+ subs->flags |= NUMBER;
+ }
+ subs->flags |= NUMCUR;
+ if (l <= INT32_MAX && l >= INT32_MIN) {
+ subs->flags |= NUMINT;
+ return & success_node;
+ }
+
return NULL;
+ #endif /* CHECK_INTEGER_USING_FORCE_NUMBER */
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 20 ++++++++++++++
Checklist | 4 +--
awk.h | 8 ++++++
dfa.c | 1 +
int_array.c | 70 ++++++++++++++++++++++++++++++++++++++++++++---
test/ChangeLog | 4 +++
test/intarray.awk | 15 ++++++++---
test/intarray.ok | 8 ------
vms/ChangeLog | 7 ++++-
vms/vmstest.com | 78 +++++++++++++++++++++++++++++++++++++++++++++++++----
10 files changed, 193 insertions(+), 22 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1943-gfeb11c0,
Arnold Robbins <=