summaryrefslogtreecommitdiff
path: root/dist/s_style
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2012-05-12 13:56:11 +0000
committerKeith Bostic <keith@wiredtiger.com>2012-05-12 13:56:11 +0000
commitf3dba71d87eac45e762541a22c5358f6851b9332 (patch)
tree30980e46b187ade68e0ee99696f8033492a57b99 /dist/s_style
parent8a57d20cab112c2632861436cbd80502de7770d6 (diff)
downloadmongo-f3dba71d87eac45e762541a22c5358f6851b9332.tar.gz
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.
Diffstat (limited to 'dist/s_style')
-rw-r--r--dist/s_style24
1 files changed, 23 insertions, 1 deletions
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