Browse Source

tools: make check-imports.sh work on bsd-likes

v0.11.5-release
Ben Noordhuis 12 years ago
parent
commit
2b7d86ec73
  1. 13
      tools/check-imports.sh

13
tools/check-imports.sh

@ -1,14 +1,21 @@
#!/bin/sh
SED=sed
UNAME=`uname`
if [ "$UNAME" = Darwin ] || [ "$UNAME" = FreeBSD ]; then
SED=gsed
fi
cd `dirname "$0"`/../
for FILE in src/*.cc; do
sed -rne 's/^using (\w+::\w+);$/\1/p' $FILE | sort -c || echo "in $FILE"
$SED -rne 's/^using (\w+::\w+);$/\1/p' $FILE | sort -c || echo "in $FILE"
done
for FILE in src/*.cc; do
for IMPORT in `sed -rne 's/^using (\w+)::(\w+);$/\2/p' $FILE`; do
if ! sed -re '/^using (\w+)::(\w+);$/d' $FILE | grep -q "$IMPORT"; then
for IMPORT in `$SED -rne 's/^using (\w+)::(\w+);$/\2/p' $FILE`; do
if ! $SED -re '/^using (\w+)::(\w+);$/d' $FILE | grep -q "$IMPORT"; then
echo "$IMPORT unused in $FILE"
fi
done

Loading…
Cancel
Save