summaryrefslogtreecommitdiff
path: root/dist/s_define
diff options
context:
space:
mode:
Diffstat (limited to 'dist/s_define')
-rw-r--r--dist/s_define32
1 files changed, 32 insertions, 0 deletions
diff --git a/dist/s_define b/dist/s_define
new file mode 100644
index 00000000000..0819a91f353
--- /dev/null
+++ b/dist/s_define
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+# Complain about unused #defines.
+t=__wt.$$
+trap 'rm -f $t; exit 0' 0 1 2 3 13 15
+
+# List of files to search.
+l=`sed -e 's,#.*,,' -e '/^$/d' -e 's,^,../,' filelist`
+l="$l `echo ../src/include/*.i ../src/utilities/*.c `"
+
+(
+# Copy out the list of #defines we don't use, but it's OK.
+sed -e '/^$/d' -e '/^#/d' < s_define.list
+
+# Get the list of #defines.
+# Ignore the list of statistic "keys" generated for applications.
+search=`cat ../src/include/*.[hi] ../src/include/*.in |
+ sed -e '/Statistics section: BEGIN/,/Statistics section: END/d' |
+ egrep '^#define' |
+ sed 's/#define[ ][ ]*\([A-Za-z_][A-Za-z0-9_]*\).*/\1/' |
+ sort -u`
+
+# Print the list of macros, followed by the occurrences: we're looking for
+# macros that only appear once.
+echo "$search"
+fgrep -who "$search" $l
+
+) | sort | uniq -u > $t
+
+test -s $t && cat $t
+
+exit 0