From e30696930a6335cee3cae0edad156bb4016ff993 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jun 2016 06:03:49 +0300 Subject: Restore mixed1 test. --- test/ChangeLog | 7 +++++++ test/Makefile.am | 2 +- test/Makefile.in | 2 +- test/mixed1.ok | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 83b45460..f0e901e4 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,10 @@ +2016-06-14 Arnold D. Robbins + + * Makefile.am (GAWK_EXT_TESTS): Add mixed1. Who knows + how long that's been broken... + * mixed1.ok: Adjust to match what the code produces. + Thanks to John E. Malmberg for the report. + 2016-06-08 Arnold D. Robbins * symtab10.awk, symtab10.in, symtab10.ok: New files. diff --git a/test/Makefile.am b/test/Makefile.am index 1f1646e9..d3842fb5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1110,7 +1110,7 @@ GAWK_EXT_TESTS = \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ include include2 indirectbuiltin indirectcall indirectcall2 \ lint lintold lintwarn \ - manyfiles match1 match2 match3 mbstr1 mbstr2 \ + mixed1 manyfiles match1 match2 match3 mbstr1 mbstr2 \ muldimposix \ nastyparm negtime next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ diff --git a/test/Makefile.in b/test/Makefile.in index df874d1b..31f018a4 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1366,7 +1366,7 @@ GAWK_EXT_TESTS = \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ include include2 indirectbuiltin indirectcall indirectcall2 \ lint lintold lintwarn \ - manyfiles match1 match2 match3 mbstr1 mbstr2 \ + mixed1 manyfiles match1 match2 match3 mbstr1 mbstr2 \ muldimposix \ nastyparm negtime next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ diff --git a/test/mixed1.ok b/test/mixed1.ok index 91608fa3..bd6f447d 100644 --- a/test/mixed1.ok +++ b/test/mixed1.ok @@ -1,3 +1,3 @@ -gawk: BEGIN {return junk} -gawk: ^ `return' used outside function context +gawk: cmd. line:1: BEGIN {return junk} +gawk: cmd. line:1: ^ `return' used outside function context EXIT CODE: 1 -- cgit v1.2.3 From 6d5e4b7a4a8839d9406702ab30af62054078d3af Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jun 2016 21:18:36 +0300 Subject: Fix long runs of backslashes in sub/gsub. --- ChangeLog | 5 +++++ builtin.c | 10 +++++++--- test/ChangeLog | 6 ++++++ test/Makefile.am | 5 ++++- test/Makefile.in | 10 +++++++++- test/Maketests | 5 +++++ test/subback.awk | 16 ++++++++++++++++ test/subback.in | 1 + test/subback.ok | 12 ++++++++++++ 9 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 test/subback.awk create mode 100644 test/subback.in create mode 100644 test/subback.ok diff --git a/ChangeLog b/ChangeLog index b7c5dc01..93e04487 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-14 Arnold D. Robbins + + * builtin.c (do_sub): Fix sub for long runs of backslashes. + Thanks to Mike Brennan for the report. + 2016-06-10 Arnold D. Robbins * config.guess, config.sub: Get latest from Gnulib master. diff --git a/builtin.c b/builtin.c index a5dba010..21f295f7 100644 --- a/builtin.c +++ b/builtin.c @@ -2876,8 +2876,10 @@ set_how_many: leave alone, it goes into the output */ } else { /* gawk default behavior since 1996 */ - if (strncmp(scan, "\\\\\\&", 4) == 0) { + if (strncmp(scan, "\\\\\\&", 4) == 0 + || strncmp(scan, "\\\\\\\\", 4) == 0) { /* 2016: fixed */ /* \\\& --> \& */ + /* \\\\ --> \\ */ repllen -= 2; scan += 3; } else if (strncmp(scan, "\\\\&", 3) == 0) { @@ -2982,10 +2984,12 @@ set_how_many: *bp++ = *scan; } else { /* gawk default behavior since 1996 */ - if (strncmp(scan, "\\\\\\&", 4) == 0) { + if (strncmp(scan, "\\\\\\&", 4) == 0 + || strncmp(scan, "\\\\\\\\", 4) == 0) { /* 2016: fixed */ /* \\\& --> \& */ + /* \\\\ --> \\ */ *bp++ = '\\'; - *bp++ = '&'; + *bp++ = scan[3]; scan += 3; } else if (strncmp(scan, "\\\\&", 3) == 0) { /* \\& --> \ */ diff --git a/test/ChangeLog b/test/ChangeLog index f0e901e4..9b16506a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2016-06-14 Arnold D. Robbins + + * Makefile.am (subback): New test. + * subback.awk, subback.in, subback.ok: New files. + Thanks to Mike Brennan for the test. + 2016-06-14 Arnold D. Robbins * Makefile.am (GAWK_EXT_TESTS): Add mixed1. Who knows diff --git a/test/Makefile.am b/test/Makefile.am index d3842fb5..3dde245e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -951,6 +951,9 @@ EXTRA_DIST = \ subamp.awk \ subamp.in \ subamp.ok \ + subback.awk \ + subback.in \ + subback.ok \ subi18n.awk \ subi18n.ok \ subsepnm.awk \ @@ -1088,7 +1091,7 @@ BASIC_TESTS = \ reparse resplit rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sigpipe1 sortempty sortglos splitargv splitarr splitdef \ - splitvar splitwht strcat1 strnum1 strtod subamp subi18n \ + splitvar splitwht strcat1 strnum1 strtod subamp subback subi18n \ subsepnm subslash substr swaplns synerr1 synerr2 tradanch tweakfld \ uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ diff --git a/test/Makefile.in b/test/Makefile.in index 31f018a4..43b15e9d 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1208,6 +1208,9 @@ EXTRA_DIST = \ subamp.awk \ subamp.in \ subamp.ok \ + subback.awk \ + subback.in \ + subback.ok \ subi18n.awk \ subi18n.ok \ subsepnm.awk \ @@ -1344,7 +1347,7 @@ BASIC_TESTS = \ reparse resplit rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sigpipe1 sortempty sortglos splitargv splitarr splitdef \ - splitvar splitwht strcat1 strnum1 strtod subamp subi18n \ + splitvar splitwht strcat1 strnum1 strtod subamp subback subi18n \ subsepnm subslash substr swaplns synerr1 synerr2 tradanch tweakfld \ uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ @@ -3499,6 +3502,11 @@ strtod: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +subback: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + subsepnm: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index c7b125c7..57b5c5ad 100644 --- a/test/Maketests +++ b/test/Maketests @@ -892,6 +892,11 @@ strtod: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +subback: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + subsepnm: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/subback.awk b/test/subback.awk new file mode 100644 index 00000000..d91513c1 --- /dev/null +++ b/test/subback.awk @@ -0,0 +1,16 @@ +BEGIN { + A[0] = "&" + for(i=1;i<=11;i++) { + A[i] = "\\" A[i-1] + } +## A[] holds & \& \\& \\\& \\\\& ... +} + +{ + for(i=0; i <= 11 ; i++) { + x = $0 + sub(/B/, A[i], x) + y = gensub(/B/, A[i], "1", $0) + print i, x, y + } +} diff --git a/test/subback.in b/test/subback.in new file mode 100644 index 00000000..223b7836 --- /dev/null +++ b/test/subback.in @@ -0,0 +1 @@ +B diff --git a/test/subback.ok b/test/subback.ok new file mode 100644 index 00000000..9792c82b --- /dev/null +++ b/test/subback.ok @@ -0,0 +1,12 @@ +0 B B +1 & & +2 \B \B +3 \& \& +4 \\B \\B +5 \\& \\& +6 \\\B \\\B +7 \\\& \\\& +8 \\\\B \\\\B +9 \\\\& \\\\& +10 \\\\\B \\\\\B +11 \\\\\& \\\\\& -- cgit v1.2.3 From 153eea8b5edefb9b6921c84de0ed1bd219610d00 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jun 2016 21:21:35 +0300 Subject: Update FAIL_CODE1 in Makefile.am. --- test/ChangeLog | 4 ++++ test/Makefile.am | 5 ++++- test/Makefile.in | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 9b16506a..59e0dae6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -4,6 +4,10 @@ * subback.awk, subback.in, subback.ok: New files. Thanks to Mike Brennan for the test. + Unrelated: + + * Makefile.am (FAIL_CODE1): Update the list. + 2016-06-14 Arnold D. Robbins * Makefile.am (GAWK_EXT_TESTS): Add mixed1. Who knows diff --git a/test/Makefile.am b/test/Makefile.am index 3dde245e..34cc954b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1154,7 +1154,10 @@ NEED_LINT_OLD = lintold # List of the tests which fail with EXIT CODE 1 FAIL_CODE1 = \ - fnarray2 fnmisc gsubasgn mixed1 noparms paramdup synerr1 synerr2 unterm + badassign1 badbuild callparam delfunc fcall_exit fcall_exit2 \ + fnamedat fnarray fnarray2 fnasgnm fnmisc funsmnam gsubasgn \ + incdupe2 lintwarn match2 mixed1 noparms paramasfunc1 paramasfunc2 \ + paramdup paramres parseme readbuf synerr1 synerr2 unterm # List of files which have .ok versions for MPFR CHECK_MPFR = \ diff --git a/test/Makefile.in b/test/Makefile.in index 43b15e9d..5baefb40 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1409,7 +1409,10 @@ NEED_LINT_OLD = lintold # List of the tests which fail with EXIT CODE 1 FAIL_CODE1 = \ - fnarray2 fnmisc gsubasgn mixed1 noparms paramdup synerr1 synerr2 unterm + badassign1 badbuild callparam delfunc fcall_exit fcall_exit2 \ + fnamedat fnarray fnarray2 fnasgnm fnmisc funsmnam gsubasgn \ + incdupe2 lintwarn match2 mixed1 noparms paramasfunc1 paramasfunc2 \ + paramdup paramres parseme readbuf synerr1 synerr2 unterm # List of files which have .ok versions for MPFR -- cgit v1.2.3 From b5a63ab37a2d018b0ae08abbf76ee2e88c3aff4c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jun 2016 21:26:41 +0300 Subject: Sync pc/Makefile.tst with mainline. --- pc/ChangeLog | 6 ++++++ pc/Makefile.tst | 22 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/pc/ChangeLog b/pc/ChangeLog index d828258d..fd872e8d 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-14 Arnold D. Robbins + + * Makefile.tst: Sync with mainline: + (mixed1, symtab10, subback): New tests. + (FAIL_CODE1): Updated. + 2016-05-25 Eli Zaretskii * Makefile.tst (BASIC_TESTS): Add arrayind1 and sigpipe1. diff --git a/pc/Makefile.tst b/pc/Makefile.tst index 404d4b66..e4414294 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -171,7 +171,7 @@ BASIC_TESTS = \ reparse resplit rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sigpipe1 sortempty sortglos splitargv splitarr splitdef \ - splitvar splitwht strcat1 strnum1 strtod subamp subi18n \ + splitvar splitwht strcat1 strnum1 strtod subamp subback subi18n \ subsepnm subslash substr swaplns synerr1 synerr2 tradanch tweakfld \ uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ @@ -193,7 +193,7 @@ GAWK_EXT_TESTS = \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ include include2 indirectbuiltin indirectcall indirectcall2 \ lint lintold lintwarn \ - manyfiles match1 match2 match3 mbstr1 mbstr2 \ + mixed1 manyfiles match1 match2 match3 mbstr1 mbstr2 \ muldimposix \ nastyparm negtime next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ @@ -203,7 +203,7 @@ GAWK_EXT_TESTS = \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ - symtab7 symtab8 symtab9 \ + symtab7 symtab8 symtab9 symtab10 \ watchpoint1 EXTRA_TESTS = inftest regtest @@ -233,7 +233,10 @@ NEED_LINT_OLD = lintold # List of the tests which fail with EXIT CODE 1 FAIL_CODE1 = \ - fnarray2 fnmisc gsubasgn mixed1 noparms paramdup synerr1 synerr2 unterm + badassign1 badbuild callparam delfunc fcall_exit fcall_exit2 \ + fnamedat fnarray fnarray2 fnasgnm fnmisc funsmnam gsubasgn \ + incdupe2 lintwarn match2 mixed1 noparms paramasfunc1 paramasfunc2 \ + paramdup paramres parseme readbuf synerr1 synerr2 unterm # List of files which have .ok versions for MPFR @@ -1281,6 +1284,12 @@ rscompat: @echo $@ @AWKPATH="$(srcdir)" $(AWK) --traditional -f $@.awk "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +symtab10: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -2171,6 +2180,11 @@ strtod: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +subback: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + subsepnm: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ -- cgit v1.2.3 From 68773e1444b7e353346e52756e9db8fb487b56d4 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 14 Jun 2016 21:28:50 +0300 Subject: Remove an unused variable. --- ChangeLog | 4 ++++ ext.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1ade7969..055eb7d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-06-14 Arnold D. Robbins + + * ext.c (get_argument): Remove unused variable pcount. + 2016-06-10 Arnold D. Robbins * config.guess, config.sub: Get latest from Gnulib master. diff --git a/ext.c b/ext.c index c0d6f150..ce040ed7 100644 --- a/ext.c +++ b/ext.c @@ -152,7 +152,7 @@ NODE * get_argument(int i) { NODE *t; - int arg_count, pcount; + int arg_count; INSTRUCTION *pc; pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ -- cgit v1.2.3