summaryrefslogtreecommitdiff
path: root/dist/s_define
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2010-02-15 10:46:44 +1100
committerKeith Bostic <keith@wiredtiger.com>2010-02-15 10:46:44 +1100
commit2d24e24b59de8e78d87768cf81cc0dbf619d1f37 (patch)
tree251c19603964b7279a2e7025e6c0b5c2fb0fc259 /dist/s_define
parent76c565580f9029883a1d13525705d655fbdb0d87 (diff)
downloadmongo-2d24e24b59de8e78d87768cf81cc0dbf619d1f37.tar.gz
Add a script to display unused #defines.
--HG-- branch : keith
Diffstat (limited to 'dist/s_define')
-rw-r--r--dist/s_define28
1 files changed, 28 insertions, 0 deletions
diff --git a/dist/s_define b/dist/s_define
new file mode 100644
index 00000000000..2f2de993571
--- /dev/null
+++ b/dist/s_define
@@ -0,0 +1,28 @@
+#! /bin/sh
+#
+# $Id$
+
+# Complain about unused #defines.
+t=__wt.$$
+trap 'rm -f $t; exit 0' 0 1 2 3 13 15
+
+(
+sed '/^#/d' < s_define.list
+for i in \
+ `cat ../inc_posix/*.h ../inc_posix/*.in |
+ egrep '^#define' |
+ sed 's/#define[ ][ ]*\([A-Za-z_]*\).*/\1/' |
+ sort -u`; do
+ if `egrep "$i" ../*/*.c ../utilities/*/*.c > /dev/null`; then
+ continue
+ fi
+ echo $i
+done
+) | sort | uniq -u > $t
+
+test -s $t && {
+ echo 'Unused #defines:'
+ sed 's/^/ /' < $t
+}
+
+exit 0