From 6bd70f6a189aed90a574bd8607a7cef353f8232e Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 25 May 2012 18:49:07 +0200 Subject: [PATCH] [ng] maintcheck: some tweaks and fixlets * syntax-checks.mk (sc_no_brace_variable_expansions): Do not complain about ${MAKEVAR} usages in comments: they might be legitimate. This change is not strictly required for mainline automake, but will help in the Automake-NG branch. * sc_tests_here_document_format: Relax a bit, so that usages like "cout << "string" << endl;" in the test scripts (usages which can be used in here documents defining C++ sources) are not flagged as uses of bad delimiters for here documents. This change is not strictly required for mainline automake, but will help in the Automake-NG branch, and will anyway be more future proof w.r.t. possible future testsuite additions. (sc_tests_Exit_not_exit): Do not whitelist lines containing $PERL explicitly (that was only required for one test); instead ... * t/ext2.sh: ... use "exit (1)" instead of "exit 1" in the perl invocation of the guilty script. Signed-off-by: Stefano Lattarini --- syntax-checks.mk | 12 ++++++------ t/ext2.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/syntax-checks.mk b/syntax-checks.mk index 402e17f..4b226a0 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -158,10 +158,10 @@ sc_perl_syntax: @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal -## expect no instances of '${...}'. However, $${...} is ok, since that +## Expect no instances of '${...}'. However, $${...} is ok, since that ## is a shell construct, not a Makefile construct. sc_no_brace_variable_expansions: - @if grep -F '$${' $(ams) | grep -F -v '$$$$'; then \ + @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \ echo "Found too many uses of '\$${' in the lines above." 1>&2; \ exit 1; \ else :; fi @@ -335,19 +335,19 @@ $(sc_tests_plain_check_rules): sc_tests_plain_% : ## Tests should only use END and EOF for here documents ## (so that the next test is effective). sc_tests_here_document_format: - @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bstd::cout <<'; then \ + @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \ echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \ exit 1; \ fi ## Tests should never call exit directly, but use Exit. ## This is so that the exit status is transported correctly across the 0 trap. -## Ignore comments, testsuite self tests, and one perl line in ext2.sh. +## Ignore comments and our testsuite's own self tests. sc_tests_Exit_not_exit: @found=false; for file in $(xtests); do \ case $$file in */self-check-*) continue;; esac; \ - res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \ - -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \ + res=`sed -n -e '/^#/d' -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \ + -e '/exit [$$0-9]/p' $$file`; \ if test -n "$$res"; then \ echo "$$file:$$res"; \ found=true; \ diff --git a/t/ext2.sh b/t/ext2.sh index 3df0282..ac5b777 100755 --- a/t/ext2.sh +++ b/t/ext2.sh @@ -63,4 +63,4 @@ cat rules #| #r-i.o: i.cxx # Bail out if we find a duplicate. -$PERL -ne 'if (exists $a{$_}) { exit 1 } else { $a{$_} = 1 }' < rules +$PERL -ne 'if (exists $a{$_}) { exit (1) } else { $a{$_} = 1 }' < rules -- 2.7.4