summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKarel Zak2007-06-15 10:17:51 +0200
committerKarel Zak2007-06-15 10:17:51 +0200
commit71be1ee4a1386c141272df32b1184857aa5c9070 (patch)
treec1a8363e71fc68ee47f3f9475fb72e3acfb28ead /tools
parentgetopt: remove old unused files (diff)
downloadkernel-qcow2-util-linux-71be1ee4a1386c141272df32b1184857aa5c9070.tar.gz
kernel-qcow2-util-linux-71be1ee4a1386c141272df32b1184857aa5c9070.tar.xz
kernel-qcow2-util-linux-71be1ee4a1386c141272df32b1184857aa5c9070.zip
tools: add codecheck-config that checks for {HAVE,ENABLE}_ orphans
Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/codecheck-config38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/codecheck-config b/tools/codecheck-config
new file mode 100755
index 000000000..ff38bac7d
--- /dev/null
+++ b/tools/codecheck-config
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+#
+# This script checks for HAVE_ and ENABLE_ macros which are
+# not included in config.h.in
+#
+# Copyright (C) 2007 Matthias Koenig <mkoenig@suse.de>
+#
+
+srcdir=$1
+
+if [ ! "$srcdir" ]; then
+ srcdir=$PWD
+fi
+
+CONFIG="$srcdir/config.h.in"
+if [ ! -f "$CONFIG" ]; then
+ echo "config.h.in is needed"
+ exit 1
+fi
+
+SOURCES=$(find $srcdir -name "*.c")
+
+for f in $SOURCES; do
+ DEFINES=$(sed -n -e 's/.*[ \t(]\+\(HAVE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
+ -e 's/.*[ \t(]\+\(ENABLE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
+ $f | sort -u)
+ [ -z "$DEFINES" ] && continue
+
+ for d in $DEFINES; do
+ case $d in
+ HAVE_CONFIG_H) continue;;
+ *) grep -q "$d\( \|\>\)" $CONFIG || echo $(echo $f | sed 's:'$srcdir/'::') ": $d"
+
+ ;;
+ esac
+ done
+done