From f3dba71d87eac45e762541a22c5358f6851b9332 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Sat, 12 May 2012 13:56:11 +0000 Subject: Add a script to check for a function return after code that jumps to an error label, and fix a bunch of problems it turned up. --- dist/s_style | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'dist/s_style') diff --git a/dist/s_style b/dist/s_style index dd71c9b6678..ccd7214a2aa 100644 --- a/dist/s_style +++ b/dist/s_style @@ -4,7 +4,29 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 -cd .. && +cd .. + +# Returns in functions after a jump to error lable. +for f in `find examples ext src test -name '*.[ci]'`; do + sed -n \ + -e '/^__wt_conn_btree_close_all(/,/^}/d' \ + -e '/^__find_next_col(/,/^}/d' \ + -e '/^{$/,/^}$/{=;p;}' $f | + sed 'N;s/\n/:/' | + sed -e '/./{H;/^[0-9][0-9]*:}$/!d;}' \ + -e x \ + -e 's/\n/ /g' \ + -e 's/\/\*.*\*\///g' \ + -e p \ + -e '{s/.*//;x;}' | + egrep 'WT_ERR\(.*WT_RET.*err:|WT_ERR_MSG\(.*WT_RET.*err:|WT_ERR_TEST\(.*WT_RET.*err:|WT_ERR\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_MSG\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_TEST\(.*WT_ILLEGAL_VALUE\(.*err:' | + sed 's/:.*//' > $t + test -s $t && { + echo "$f: function with return after a jump to an error label" + sed 's/^/function @ line:/' < $t + } +done + for f in `find examples ext src test -name '*.[chisy]' -o -name '*.in' | sed '/Makefile.in/d'`; do if grep "^[^}]*while (0);" $f > $t; then -- cgit v1.2.1