From eccbbe18b119f60bcb4e33259f43f6f3cc0d2581 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 24 Jan 2015 19:51:55 +0200 Subject: Move to Automake 1.15. --- test/Makefile.in | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/Makefile.in b/test/Makefile.in index e01e273f..215ba892 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -37,7 +37,17 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -100,9 +110,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/Maketests $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/mkinstalldirs ChangeLog \ - README subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ @@ -118,6 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -142,6 +150,8 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Maketests \ + $(top_srcdir)/mkinstalldirs ChangeLog README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -1356,7 +1366,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Maketests $(am__configur echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -1365,6 +1374,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(srcdir)/Maketests $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -1523,6 +1533,8 @@ uninstall-am: maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am +.PRECIOUS: Makefile + # Message stuff is to make it a little easier to follow. # Make the pass-fail last and dependent on others to avoid -- cgit v1.2.3 From 1bd1b885c7dd16b5e4ab78c040312f6f7d742784 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 30 Jan 2015 10:06:16 +0200 Subject: Disallow calling a function parameter. Check params are not function names. --- test/ChangeLog | 8 ++++++++ test/Makefile.am | 9 ++++++++- test/Makefile.in | 24 +++++++++++++++++++++++- test/Maketests | 15 +++++++++++++++ test/callparam.awk | 6 ++++++ test/callparam.ok | 2 ++ test/exit.sh | 2 +- test/indirectcall.awk | 8 ++++---- test/paramasfunc1.awk | 9 +++++++++ test/paramasfunc1.ok | 3 +++ test/paramasfunc2.awk | 10 ++++++++++ test/paramasfunc2.ok | 3 +++ 12 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 test/callparam.awk create mode 100644 test/callparam.ok create mode 100644 test/paramasfunc1.awk create mode 100644 test/paramasfunc1.ok create mode 100644 test/paramasfunc2.awk create mode 100644 test/paramasfunc2.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 04e65b5a..97b3d40b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,11 @@ +2015-01-30 Arnold D. Robbins + + * Makefile.in (callparam, paramasfunc1, paramasfunc2): New tests. + * callparam.awk, callparam.ok: New files. + * paramasfunc1.awk, paramasfunc1.ok: New files. + * paramasfunc2.awk, paramasfunc2.ok: New files. + * exit.sh, indirectcall.awk: Update after code change. + 2015-01-14 Arnold D. Robbins * Makefile.am (dumpvars): Grep out ENVIRON and PROCINFO since diff --git a/test/Makefile.am b/test/Makefile.am index bd2903ab..4a90beb4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -132,6 +132,8 @@ EXTRA_DIST = \ beginfile2.ok \ beginfile2.sh \ binmode1.ok \ + callparam.awk \ + callparam.ok \ charasbytes.awk \ charasbytes.in \ charasbytes.ok \ @@ -642,6 +644,10 @@ EXTRA_DIST = \ out1.ok \ out2.ok \ out3.ok \ + paramasfunc1.awk \ + paramasfunc1.ok \ + paramasfunc2.awk \ + paramasfunc2.ok \ paramdup.awk \ paramdup.ok \ paramres.awk \ @@ -983,7 +989,7 @@ BASIC_TESTS = \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ back89 backgsub badassign1 badbuild \ - childin clobber closebad clsflnam compare compare2 concat1 concat2 \ + callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ eofsplit exit2 exitval1 exitval2 \ @@ -1001,6 +1007,7 @@ BASIC_TESTS = \ nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \ noparms nors nulrsend numindex numsubstr \ octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \ + paramasfunc1 paramasfunc2 \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ diff --git a/test/Makefile.in b/test/Makefile.in index 215ba892..97171726 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -389,6 +389,8 @@ EXTRA_DIST = \ beginfile2.ok \ beginfile2.sh \ binmode1.ok \ + callparam.awk \ + callparam.ok \ charasbytes.awk \ charasbytes.in \ charasbytes.ok \ @@ -899,6 +901,10 @@ EXTRA_DIST = \ out1.ok \ out2.ok \ out3.ok \ + paramasfunc1.awk \ + paramasfunc1.ok \ + paramasfunc2.awk \ + paramasfunc2.ok \ paramdup.awk \ paramdup.ok \ paramres.awk \ @@ -1239,7 +1245,7 @@ BASIC_TESTS = \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ back89 backgsub badassign1 badbuild \ - childin clobber closebad clsflnam compare compare2 concat1 concat2 \ + callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ eofsplit exit2 exitval1 exitval2 \ @@ -1257,6 +1263,7 @@ BASIC_TESTS = \ nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \ noparms nors nulrsend numindex numsubstr \ octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \ + paramasfunc1 paramasfunc2 \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ @@ -2572,6 +2579,11 @@ badbuild: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +callparam: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + childin: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -3042,6 +3054,16 @@ opasnslf: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +paramasfunc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +paramasfunc2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + paramdup: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 5c4c40f9..41c85c01 100644 --- a/test/Maketests +++ b/test/Maketests @@ -130,6 +130,11 @@ badbuild: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +callparam: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + childin: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -600,6 +605,16 @@ opasnslf: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +paramasfunc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +paramasfunc2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + paramdup: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/callparam.awk b/test/callparam.awk new file mode 100644 index 00000000..b925db01 --- /dev/null +++ b/test/callparam.awk @@ -0,0 +1,6 @@ +BEGIN { f() } + +function f( a, b) +{ + a = b() +} diff --git a/test/callparam.ok b/test/callparam.ok new file mode 100644 index 00000000..00a027e8 --- /dev/null +++ b/test/callparam.ok @@ -0,0 +1,2 @@ +gawk: callparam.awk:5: error: attempt to use non-function `b' in function call +EXIT CODE: 1 diff --git a/test/exit.sh b/test/exit.sh index 9510dcdc..3922f83c 100755 --- a/test/exit.sh +++ b/test/exit.sh @@ -30,7 +30,7 @@ x='function f(){ exit}; BEGINFILE {f()}; NR>1{ f()}; END{print NR}' $AWK 'BEGIN { print "a\nb" }' | $AWK "$x" echo "-- 5" -y='function strip(f) { sub(/.*\//, "", f); return f };' +y='function strip(val) { sub(/.*\//, "", val); return val };' x='BEGINFILE{if(++i==1) exit;}; END{print i, strip(FILENAME)}' $AWK "$y$x" /dev/null $0 diff --git a/test/indirectcall.awk b/test/indirectcall.awk index 5cfdd235..74290973 100644 --- a/test/indirectcall.awk +++ b/test/indirectcall.awk @@ -5,13 +5,13 @@ # average --- return the average of the values in fields $first - $last -function average(first, last, sum, i) +function average(first, last, the_sum, i) { - sum = 0; + the_sum = 0; for (i = first; i <= last; i++) - sum += $i + the_sum += $i - return sum / (last - first + 1) + return the_sum / (last - first + 1) } # sum --- return the average of the values in fields $first - $last diff --git a/test/paramasfunc1.awk b/test/paramasfunc1.awk new file mode 100644 index 00000000..b0d06849 --- /dev/null +++ b/test/paramasfunc1.awk @@ -0,0 +1,9 @@ +BEGIN{ X() } + +function X( abc) +{ + abc = "stamp out " + print abc abc() +} + +function abc() { return "dark corners" } diff --git a/test/paramasfunc1.ok b/test/paramasfunc1.ok new file mode 100644 index 00000000..9ee95116 --- /dev/null +++ b/test/paramasfunc1.ok @@ -0,0 +1,3 @@ +gawk: paramasfunc1.awk:6: error: attempt to use non-function `abc' in function call +gawk: error: function `X': can't use function `abc' as a parameter name +EXIT CODE: 1 diff --git a/test/paramasfunc2.awk b/test/paramasfunc2.awk new file mode 100644 index 00000000..849b3d1b --- /dev/null +++ b/test/paramasfunc2.awk @@ -0,0 +1,10 @@ +BEGIN{ X() } + +function abc() { return "dark corners" } + +function X( abc) +{ + abc = "stamp out " + print abc abc() +} + diff --git a/test/paramasfunc2.ok b/test/paramasfunc2.ok new file mode 100644 index 00000000..2cdf4f66 --- /dev/null +++ b/test/paramasfunc2.ok @@ -0,0 +1,3 @@ +gawk: paramasfunc2.awk:8: error: attempt to use non-function `abc' in function call +gawk: error: function `X': can't use function `abc' as a parameter name +EXIT CODE: 1 -- cgit v1.2.3