diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-09 21:02:45 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-09 21:02:45 +0300 |
commit | 63e02ea9ae9921a45d36ab631fa31593cf149370 (patch) | |
tree | 1c2cef3799d90835a14fc85693c2d110a67f657e | |
parent | 45ec9a480a99df0242bcf22785528445a3675931 (diff) | |
parent | c51a97fc72b732d19dbc83a7a4aadf9893a92b78 (diff) | |
download | egawk-63e02ea9ae9921a45d36ab631fa31593cf149370.tar.gz egawk-63e02ea9ae9921a45d36ab631fa31593cf149370.tar.bz2 egawk-63e02ea9ae9921a45d36ab631fa31593cf149370.zip |
Merge branch 'master' into feature/api-mpfr
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | str_array.c | 9 | ||||
-rw-r--r-- | test/ChangeLog | 9 | ||||
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/Makefile.in | 7 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/aryunasgn.awk | 17 | ||||
-rw-r--r-- | test/aryunasgn.ok | 8 | ||||
-rw-r--r-- | test/badargs.ok | 6 |
10 files changed, 71 insertions, 8 deletions
@@ -1,3 +1,13 @@ +2017-08-09 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Add URL for Bug reporting info to the help message. + + Unrelated: + + * str_array.c (str_lookup): Make a copy of the string if it + came from Nnull_string or a null field. Thanks to + Daniel Pettet for the report. + 2017-08-04 Arnold D. Robbins <arnold@skeeve.com> * array.c, awk.h, awkgram.y, builtin.c, cint_array.c, @@ -613,8 +613,10 @@ usage(int exitval, FILE *fp) for this application. Please add _another line_ with the address for translation bugs. no-wrap */ - fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info', which is\n\ -section `Reporting Problems and Bugs' in the printed version.\n\n"), fp); + fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info'\n\ +which is section `Reporting Problems and Bugs' in the\n\ +printed version. This same information may be found at\n\ +https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.\n\n"), fp); /* ditto */ fputs(_("gawk is a pattern scanning and processing language.\n\ diff --git a/str_array.c b/str_array.c index 55e90497..8d6d2b01 100644 --- a/str_array.c +++ b/str_array.c @@ -165,8 +165,13 @@ str_lookup(NODE *symbol, NODE *subs) * "Array indices are always strings." * .... */ - if (subs->stfmt != STFMT_UNUSED) { - /* The string was generated using CONVFMT. */ + // Special cases: + // 1. The string was generated using CONVFMT. + // 2. The string was from an unassigned variable. + // 3. The string was from an unassigned field. + if ( subs->stfmt != STFMT_UNUSED + || subs == Nnull_string + || (subs->flags & NULL_FIELD) != 0) { NODE *tmp; /* diff --git a/test/ChangeLog b/test/ChangeLog index 90051a9b..ee361790 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2017-08-09 Arnold D. Robbins <arnold@skeeve.com> + + * badargs.ok: Update after code changes. + + Unrelated: + + * Makefile.am (aryunasgn): New test. + * aryunasgn.awk, aryunasgn.ok: New files. + 2017-08-04 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am: Update copyright year. diff --git a/test/Makefile.am b/test/Makefile.am index dddcf931..f519b0db 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1199,7 +1199,7 @@ BASIC_TESTS = \ addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ - aryprm8 aryprm9 arysubnm asgext awkpath \ + aryprm8 aryprm9 arysubnm aryunasgn asgext awkpath \ back89 backgsub badassign1 badbuild \ callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 concat5 convfmt \ diff --git a/test/Makefile.in b/test/Makefile.in index 2b21e0a7..a6e4f96e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1456,7 +1456,7 @@ BASIC_TESTS = \ addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ - aryprm8 aryprm9 arysubnm asgext awkpath \ + aryprm8 aryprm9 arysubnm aryunasgn asgext awkpath \ back89 backgsub badassign1 badbuild \ callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 concat5 convfmt \ @@ -2990,6 +2990,11 @@ arysubnm: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +aryunasgn: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + asgext: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index f8c54f94..e6a2f300 100644 --- a/test/Maketests +++ b/test/Maketests @@ -130,6 +130,11 @@ arysubnm: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +aryunasgn: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + asgext: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/aryunasgn.awk b/test/aryunasgn.awk new file mode 100644 index 00000000..ccb3fd23 --- /dev/null +++ b/test/aryunasgn.awk @@ -0,0 +1,17 @@ +BEGIN { + a[i] = "null" # i is initially undefined + for (i in a) { # i is null string + print length(i), a[i] # , typeof(i) # 0 null + print (i==0), (i=="") # 1 1 should be 0 1 + } + print a[""] # null + print a[0] # + + b[$2] = "null also" # $2 is also undefined + for (j in b) { + print length(j), a[j] # , typeof(i) # 0 null + print (j==0), (j=="") # 1 1 should be 0 1 + } + print b[""] # null + print b[0] # +} diff --git a/test/aryunasgn.ok b/test/aryunasgn.ok new file mode 100644 index 00000000..798c6de3 --- /dev/null +++ b/test/aryunasgn.ok @@ -0,0 +1,8 @@ +0 null +0 1 +null + +0 null +0 1 +null also + diff --git a/test/badargs.ok b/test/badargs.ok index cd66dda0..6b3d88bd 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -31,8 +31,10 @@ Short options: GNU long options: (extensions) -t --lint-old -V --version -To report bugs, see node `Bugs' in `gawk.info', which is -section `Reporting Problems and Bugs' in the printed version. +To report bugs, see node `Bugs' in `gawk.info' +which is section `Reporting Problems and Bugs' in the +printed version. This same information may be found at +https://www.gnu.org/software/gawk/manual/html_node/Bugs.html. gawk is a pattern scanning and processing language. By default it reads standard input and writes standard output. |