gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5599-ge73fd487


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5599-ge73fd487
Date: Wed, 22 Jan 2025 11:01:17 -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.3-stable has been updated
       via  e73fd4871a9e365d9dfbab11d2c9ba8d1f9e6ebf (commit)
      from  cab80bbed3a2ec2a6fb37719ae9bd3465fe7551d (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=e73fd4871a9e365d9dfbab11d2c9ba8d1f9e6ebf

commit e73fd4871a9e365d9dfbab11d2c9ba8d1f9e6ebf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jan 22 18:00:51 2025 +0200

    Fix indirect calls of builtins preceded by awk::.

diff --git a/ChangeLog b/ChangeLog
index 775a1f5a..c0638546 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2025-01-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * configure.ac: Add hack if GCC to use -O3 instead of -O2.
+       
+       Unrelated:
+
+       * builtin.c (call_sub, call_split_func): Handle the case of
+       the function name being preceded by awk::.
+       Thanks to Denis Shirokov <cosmogen@gmail.com> for the reports.
 
 2025-01-20         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/builtin.c b/builtin.c
index adb5c0fb..f39c274c 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2212,9 +2212,13 @@ call_sub(const char *name, int nargs)
        NODE **lhs, *rhs;
        NODE *zero = make_number(0.0);
        NODE *result;
+       const char *fname = name;
 
-       if (name[0] == 'g') {
-               if (name[1] == 'e')
+       if (fname[0] == 'a')    // awk::...
+               fname += 5;
+
+       if (fname[0] == 'g') {
+               if (fname[1] == 'e')
                        flags = GENSUB;
                else
                        flags = GSUB;
@@ -2350,12 +2354,16 @@ call_split_func(const char *name, int nargs)
 {
        NODE *regex, *seps;
        NODE *result;
+       const char *fname = name;
 
        regex = seps = NULL;
        if (nargs < 2 || nargs > 4)
                fatal(_("indirect call to %s requires two to four arguments"),
                                name);
 
+       if (fname[0] == 'a')    // awk::...
+               fname += 5;
+
        if (nargs == 4)
                seps = POP();
 
@@ -2369,7 +2377,7 @@ call_split_func(const char *name, int nargs)
                        need_free = true;
                }
        } else {
-               if (name[0] == 's') {
+               if (fname[0] == 's') {
                        regex = make_regnode(Node_regex, FS_node->var_value);
                        regex->re_flags |= FS_DFLT;
                } else
@@ -2386,7 +2394,7 @@ call_split_func(const char *name, int nargs)
        if (seps)
                PUSH(seps);
 
-       result = (name[0] == 's') ? do_split(nargs) : do_patsplit(nargs);
+       result = (fname[0] == 's') ? do_split(nargs) : do_patsplit(nargs);
 
        if (need_free) {
                refree(regex->re_reg[0]);
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 0c3503f5..e7898486 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2025-01-22         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2025-01-07         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 0c89f2ad..b37a36f1 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -223,7 +223,7 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       delmessy indirectbuiltin3 \
+       delmessy indirectbuiltin3 indirectbuiltin4 \
        typeof4 typeof5 typeof6 typeof7 typeof8 typeof9 unicode1 watchpoint1
 
 ARRAYDEBUG_TESTS = arrdbg
@@ -3679,6 +3679,11 @@ indirectbuiltin3:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+indirectbuiltin4:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typeof4:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index a54baf04..da30c8f9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2025-01-22         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRADIST): New test, indirectbuiltin4.
+       * indirectbuiltin4.awk, indirectbuiltin4.ok: New files.
+
 2025-01-07         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRADIST): New test, indirectbuiltin3.
diff --git a/test/Makefile.am b/test/Makefile.am
index a3a72456..7480527d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -631,6 +631,8 @@ EXTRA_DIST = \
        indirectbuiltin2.ok \
        indirectbuiltin3.awk \
        indirectbuiltin3.ok \
+       indirectbuiltin4.awk \
+       indirectbuiltin4.ok \
        indirectcall2.awk \
        indirectcall2.ok \
        indirectcall3.awk \
@@ -1605,7 +1607,7 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       delmessy indirectbuiltin3 \
+       delmessy indirectbuiltin3 indirectbuiltin4 \
        typeof4 typeof5 typeof6 typeof7 typeof8 typeof9 unicode1 watchpoint1
 
 ARRAYDEBUG_TESTS = arrdbg
diff --git a/test/Makefile.in b/test/Makefile.in
index 668f8e94..31c11880 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -895,6 +895,8 @@ EXTRA_DIST = \
        indirectbuiltin2.ok \
        indirectbuiltin3.awk \
        indirectbuiltin3.ok \
+       indirectbuiltin4.awk \
+       indirectbuiltin4.ok \
        indirectcall2.awk \
        indirectcall2.ok \
        indirectcall3.awk \
@@ -1869,7 +1871,7 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       delmessy indirectbuiltin3 \
+       delmessy indirectbuiltin3 indirectbuiltin4 \
        typeof4 typeof5 typeof6 typeof7 typeof8 typeof9 unicode1 watchpoint1
 
 ARRAYDEBUG_TESTS = arrdbg
@@ -5503,6 +5505,11 @@ indirectbuiltin3:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+indirectbuiltin4:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typeof4:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 093fa5e7..de282763 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2357,6 +2357,11 @@ indirectbuiltin3:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+indirectbuiltin4:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typeof4:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/indirectbuiltin4.awk b/test/indirectbuiltin4.awk
new file mode 100644
index 00000000..fc435e3d
--- /dev/null
+++ b/test/indirectbuiltin4.awk
@@ -0,0 +1,5 @@
+BEGIN {
+       f = "awk::gensub"
+       a = b = c = d = ""
+       @f( a, b, c, d )
+}
diff --git a/test/indirectbuiltin4.ok b/test/indirectbuiltin4.ok
new file mode 100644
index 00000000..6b9a1fa3
--- /dev/null
+++ b/test/indirectbuiltin4.ok
@@ -0,0 +1 @@
+gawk: indirectbuiltin4.awk:4: warning: gensub: third argument `' treated as 1

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

Summary of changes:
 ChangeLog                 |  6 ++++++
 builtin.c                 | 16 ++++++++++++----
 pc/ChangeLog              |  4 ++++
 pc/Makefile.tst           |  7 ++++++-
 test/ChangeLog            |  5 +++++
 test/Makefile.am          |  4 +++-
 test/Makefile.in          |  9 ++++++++-
 test/Maketests            |  5 +++++
 test/indirectbuiltin4.awk |  5 +++++
 test/indirectbuiltin4.ok  |  1 +
 10 files changed, 55 insertions(+), 7 deletions(-)
 create mode 100644 test/indirectbuiltin4.awk
 create mode 100644 test/indirectbuiltin4.ok


hooks/post-receive
-- 
gawk



reply via email to

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