[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4384-g656b5bbe
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4384-g656b5bbe |
Date: |
Sun, 27 Mar 2022 00:58:34 -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, gawk-5.1-stable has been updated
via 656b5bbec59a3094ae13f3bdac7ae2ef1e2fb5e9 (commit)
from 6739849e21c5bfd849b0c4029c2950902e7656af (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=656b5bbec59a3094ae13f3bdac7ae2ef1e2fb5e9
commit 656b5bbec59a3094ae13f3bdac7ae2ef1e2fb5e9
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Mar 27 07:58:02 2022 +0300
Fix nested indirect calls, add test case.
diff --git a/ChangeLog b/ChangeLog
index 63cce95d..089db59a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ Allow nested indirect function calls. Thanks to
+ Kaz Kylheku <kaz@kylheku.com> for the report.
+
+ * awkgram.y (at_seen): Turn into an int that is incremented
+ and decremented as appropriate.
+
2022-03-22 Arnold D. Robbins <arnold@skeeve.com>
Make lint checks for builtin functions smarter. Initial
diff --git a/awkgram.c b/awkgram.c
index 194b49e5..2ada68d1 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -156,7 +156,7 @@ static void merge_comments(INSTRUCTION *c1, INSTRUCTION
*c2);
static INSTRUCTION *make_braced_statements(INSTRUCTION *lbrace, INSTRUCTION
*stmts, INSTRUCTION *rbrace);
static void add_sign_to_num(NODE *n, char sign);
-static bool at_seen = false;
+static int at_seen = 0;
static bool want_source = false;
static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
@@ -2056,7 +2056,7 @@ yyreduce:
#line 301 "awkgram.y"
{
want_source = false;
- at_seen = false;
+ at_seen--;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0];
@@ -2070,7 +2070,7 @@ yyreduce:
#line 311 "awkgram.y"
{
want_source = false;
- at_seen = false;
+ at_seen--;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
SRCFILE *s = (SRCFILE *) yyvsp[-1];
s->comment = yyvsp[0];
@@ -2097,7 +2097,7 @@ yyreduce:
want_source = false;
want_namespace = false;
- at_seen = false;
+ at_seen--;
// this frees $3 storage in all cases
set_namespace(yyvsp[-1], yyvsp[0]);
@@ -2328,7 +2328,7 @@ yyreduce:
#line 505 "awkgram.y"
{
yyval = yyvsp[0];
- at_seen = false;
+ at_seen--;
}
#line 2334 "awkgram.c"
break;
@@ -4297,7 +4297,7 @@ regular_print:
*/
yyval = list_prepend(yyvsp[0], t);
- at_seen = false;
+ at_seen--;
}
#line 4303 "awkgram.c"
break;
@@ -6298,7 +6298,7 @@ retry:
goto collect_regexp;
}
pushback();
- at_seen = true;
+ at_seen++;
return lasttok = '@';
case '\\':
diff --git a/awkgram.y b/awkgram.y
index 072d8adf..b75cc2e4 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -111,7 +111,7 @@ static void merge_comments(INSTRUCTION *c1, INSTRUCTION
*c2);
static INSTRUCTION *make_braced_statements(INSTRUCTION *lbrace, INSTRUCTION
*stmts, INSTRUCTION *rbrace);
static void add_sign_to_num(NODE *n, char sign);
-static bool at_seen = false;
+static int at_seen = 0;
static bool want_source = false;
static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
@@ -300,7 +300,7 @@ rule
| '@' LEX_INCLUDE source statement_term
{
want_source = false;
- at_seen = false;
+ at_seen--;
if ($3 != NULL && $4 != NULL) {
SRCFILE *s = (SRCFILE *) $3;
s->comment = $4;
@@ -310,7 +310,7 @@ rule
| '@' LEX_LOAD library statement_term
{
want_source = false;
- at_seen = false;
+ at_seen--;
if ($3 != NULL && $4 != NULL) {
SRCFILE *s = (SRCFILE *) $3;
s->comment = $4;
@@ -333,7 +333,7 @@ rule
want_source = false;
want_namespace = false;
- at_seen = false;
+ at_seen--;
// this frees $3 storage in all cases
set_namespace($3, $4);
@@ -504,7 +504,7 @@ func_name
| '@' LEX_EVAL
{
$$ = $2;
- at_seen = false;
+ at_seen--;
}
;
@@ -2041,7 +2041,7 @@ func_call
*/
$$ = list_prepend($2, t);
- at_seen = false;
+ at_seen--;
}
;
@@ -3790,7 +3790,7 @@ retry:
goto collect_regexp;
}
pushback();
- at_seen = true;
+ at_seen++;
return lasttok = '@';
case '\\':
diff --git a/pc/ChangeLog b/pc/ChangeLog
index c5043baf..3602be5b 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2022-12-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 4b3fb0a5..cb949286 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -198,7 +198,7 @@ GAWK_EXT_TESTS = \
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
+ indirectcall indirectcall2 indirectcall3 inf-nan-torture intarray
iolint \
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
@@ -2913,6 +2913,11 @@ indirectcall2:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+indirectcall3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
inf-nan-torture:
@echo $@ $(ZOS_FAIL)
@echo Expect $@ to fail with MinGW.
diff --git a/test/ChangeLog b/test/ChangeLog
index ddae26ea..27745de9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): indirectcall3, new test.
+ * indirectcall3.awk, indirectcall3.ok: New files.
+
2022-02-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.am (EXTRA_DIST): close_status, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 96dd3027..0f79b8ca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -573,6 +573,8 @@ EXTRA_DIST = \
indirectbuiltin2.ok \
indirectcall2.awk \
indirectcall2.ok \
+ indirectcall3.awk \
+ indirectcall3.ok \
indirectcall.awk \
indirectcall.in \
indirectcall.ok \
@@ -1455,7 +1457,7 @@ GAWK_EXT_TESTS = \
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
+ indirectcall indirectcall2 indirectcall3 inf-nan-torture intarray
iolint \
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
diff --git a/test/Makefile.in b/test/Makefile.in
index 94699c32..174d329d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -839,6 +839,8 @@ EXTRA_DIST = \
indirectbuiltin2.ok \
indirectcall2.awk \
indirectcall2.ok \
+ indirectcall3.awk \
+ indirectcall3.ok \
indirectcall.awk \
indirectcall.in \
indirectcall.ok \
@@ -1721,7 +1723,7 @@ GAWK_EXT_TESTS = \
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
+ indirectcall indirectcall2 indirectcall3 inf-nan-torture intarray
iolint \
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
@@ -4600,6 +4602,11 @@ indirectcall2:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+indirectcall3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
inf-nan-torture:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 26831128..d206f2e4 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1648,6 +1648,11 @@ indirectcall2:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+indirectcall3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
inf-nan-torture:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/indirectcall3.awk b/test/indirectcall3.awk
new file mode 100644
index 00000000..67181112
--- /dev/null
+++ b/test/indirectcall3.awk
@@ -0,0 +1,16 @@
+function okay(f1, f2, arg)
+{
+ return @f1(arg)
+}
+
+function not_so_hot(f1, f2, arg)
+{
+ return @f1(arg, @f2(arg)) # line 8: error here
+}
+
+function workaround(f1, f2, arg,
+ tmp)
+{
+ tmp = @f2(arg)
+ return @f1(arg, tmp)
+}
diff --git a/test/indirectcall3.ok b/test/indirectcall3.ok
new file mode 100644
index 00000000..e69de29b
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
awkgram.c | 14 +++++++-------
awkgram.y | 14 +++++++-------
pc/ChangeLog | 4 ++++
pc/Makefile.tst | 7 ++++++-
test/ChangeLog | 5 +++++
test/Makefile.am | 4 +++-
test/Makefile.in | 9 ++++++++-
test/Maketests | 5 +++++
test/indirectcall3.awk | 16 ++++++++++++++++
test/{arrayprm2.ok => indirectcall3.ok} | 0
11 files changed, 69 insertions(+), 17 deletions(-)
create mode 100644 test/indirectcall3.awk
copy test/{arrayprm2.ok => indirectcall3.ok} (100%)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4384-g656b5bbe,
Arnold Robbins <=