diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-03 19:47:04 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-03 19:47:04 +0300 |
commit | 3d88a52ad1f67594f8c32c0e8c3f855dde8c6381 (patch) | |
tree | 38996926bfdb9df5c06a67818cfb18565531a66d | |
parent | 5482bf19246965d6839fe9df1aec0785f0b1a329 (diff) | |
download | egawk-3d88a52ad1f67594f8c32c0e8c3f855dde8c6381.tar.gz egawk-3d88a52ad1f67594f8c32c0e8c3f855dde8c6381.tar.bz2 egawk-3d88a52ad1f67594f8c32c0e8c3f855dde8c6381.zip |
Fix corner case use of exit.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | eval.c | 8 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/exit2.awk | 2 | ||||
-rw-r--r-- | test/exit2.ok | 0 |
8 files changed, 35 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2013-06-03 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (unwind_stack): If exiting, don't worry about strange stuff + on the stack. + 2013-06-01 Eli Zaretskii <eliz@gnu.org> * io.c (SHUT_RD) [SD_RECEIVE]: Define to SD_RECEIVE. @@ -1462,7 +1462,13 @@ unwind_stack(long n) freenode(r); break; default: - if (in_main_context()) + /* + * Check `exiting' and don't produce an error for + * cases like: + * func _fn0() { exit } + * BEGIN { ARRAY[_fn0()] } + */ + if (in_main_context() && ! exiting) fatal(_("unwind_stack: unexpected type `%s'"), nodetype2str(r->type)); /* else diff --git a/test/ChangeLog b/test/ChangeLog index b5726c9d..108acf03 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2013-06-03 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (exit2): New test. + * exit2.awk, exit2.ok: New files. + 2013-06-01 Eli Zaretskii <eliz@gnu.org> * clos1way.awk: Don't use features of Posix shells, to allow this diff --git a/test/Makefile.am b/test/Makefile.am index 8f55e6e6..decb35c3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -192,6 +192,8 @@ EXTRA_DIST = \ eofsplit.ok \ exit.ok \ exit.sh \ + exit2.awk \ + exit2.ok \ exitval1.awk \ exitval1.ok \ exitval2.awk \ @@ -924,7 +926,7 @@ BASIC_TESTS = \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfastress dynlj \ - eofsplit exitval1 exitval2 \ + eofsplit exit2 exitval1 exitval2 \ fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \ fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \ fstabplus funsemnl funsmnam funstack \ diff --git a/test/Makefile.in b/test/Makefile.in index 05a9bfde..ecdc0fd0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -410,6 +410,8 @@ EXTRA_DIST = \ eofsplit.ok \ exit.ok \ exit.sh \ + exit2.awk \ + exit2.ok \ exitval1.awk \ exitval1.ok \ exitval2.awk \ @@ -1141,7 +1143,7 @@ BASIC_TESTS = \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfastress dynlj \ - eofsplit exitval1 exitval2 \ + eofsplit exit2 exitval1 exitval2 \ fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \ fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \ fstabplus funsemnl funsmnam funstack \ @@ -2431,6 +2433,11 @@ eofsplit: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +exit2: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + exitval2: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index d0346a8b..0cdbfa4c 100644 --- a/test/Maketests +++ b/test/Maketests @@ -205,6 +205,11 @@ eofsplit: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +exit2: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + exitval2: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/exit2.awk b/test/exit2.awk new file mode 100644 index 00000000..ffbb0430 --- /dev/null +++ b/test/exit2.awk @@ -0,0 +1,2 @@ +function _fn0() { exit } +BEGIN { ARRAY[_fn0()] } diff --git a/test/exit2.ok b/test/exit2.ok new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/exit2.ok |