#! /bin/sh

# Complain about unused statistics fields.
t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15

# List of files to search: skip stat.c, it lists all of the fields by
# definition.
l=`sed \
    -e '/src\/support\/stat.c/d' \
    -e 's,#.*,,' \
    -e '/^$/d' \
    -e 's,^,../,' filelist`
l="$l `echo ../src/include/*.i`"

(
# Get the list of statistics fields.
search=`sed \
    -e 's/^	int64_t \([a-z_*]*\);$/\1/p' \
    -e d ../src/include/stat.h |
    sort`

echo "$search"
fgrep -who "$search" $l) | sort | uniq -u > $t

test -s $t && {
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	echo 'unused statistics fields'
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	cat $t
	exit 1
}
exit 0
