Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some scripts I used in my header-cleanups branch
Usage: ./search-headers.sh | tee RESULTS ./search-warnings-headers.sh ./search-files.sh | tee RESULTS ./search-warnings-files.sh and then, uh, figure it out. :-)
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
warn() { | ||
echo "$@" >&2 | ||
git checkout -q HEAD $2 | ||
} | ||
|
||
FLAGS="-DUSE_THE_INDEX_COMPATIBILITY_MACROS -DHAVE_FSMONITOR_DAEMON_BACKEND -Wmissing-prototypes" | ||
for f in `git grep -l 'include.*"cache.h"' -- '*.c'`; do | ||
sed -i 's/#include "cache.h"/#include "git-compat-util.h"/' $f | ||
|
||
if gcc $FLAGS -E -I. $f 2>/dev/null | grep -e '"cache.h"' -e '/cache.h"' >/dev/null; then | ||
warn FAILURE-PREPROCESS $f | ||
continue | ||
fi | ||
|
||
OBJ_FILE=$(echo $f | sed -e s/\\.c$/\\.o/) | ||
if ! make DEVELOPER=1 $OBJ_FILE >/dev/null 2>&1; then | ||
|
||
if gcc -c $FLAGS -I. $f >/dev/null 2>&1; then | ||
echo SUCCESS-WITH-WARNINGS $f | ||
git checkout -q HEAD $f | ||
continue | ||
fi | ||
|
||
warn FAILURE-COMPILE $f | ||
continue | ||
fi | ||
|
||
echo SUCCESS $f | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
warn() { | ||
echo "$@" >&2 | ||
git checkout -q HEAD $2 | ||
} | ||
|
||
FLAGS="-DUSE_THE_INDEX_COMPATIBILITY_MACROS -DHAVE_FSMONITOR_DAEMON_BACKEND -Wmissing-prototypes" | ||
for f in `git grep -l 'include.*"cache.h"' -- '*.h'`; do | ||
sed -i '/#include "cache.h"/d' $f | ||
|
||
if gcc $FLAGS -E -I. $f | grep '"cache.h"' >/dev/null; then | ||
warn FAILURE-PREPROCESS $f | ||
continue | ||
fi | ||
|
||
cat >temp.c <<-EOF && | ||
#include "git-compat-util.h" | ||
#include "$f" | ||
int main() {} | ||
EOF | ||
|
||
if ! gcc -c $FLAGS -I. temp.c >output 2>&1; then | ||
warn FAILURE-COMPILE $f | ||
rm output | ||
continue | ||
fi | ||
|
||
if [[ -s output ]]; then | ||
echo SUCCESS-WITH-WARNINGS $f | ||
git checkout -q HEAD $f | ||
rm output | ||
continue | ||
fi | ||
|
||
rm output | ||
echo SUCCESS $f | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
FLAGS="-DUSE_THE_INDEX_COMPATIBILITY_MACROS -DHAVE_FSMONITOR_DAEMON_BACKEND -Wmissing-prototypes" | ||
for f in $(grep WARNINGS RESULTS | awk {print\$2}); do | ||
echo "======================================================================" | ||
echo "=== $f ===" | ||
echo "======================================================================" | ||
sed -i 's/#include "cache.h"/#include "git-compat-util.h"/' $f | ||
OBJ_FILE=$(echo $f | sed -e s/\\.c$/\\.o/) | ||
make DEVELOPER=1 $OBJ_FILE | ||
git checkout -q HEAD $f | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
FLAGS="-DUSE_THE_INDEX_COMPATIBILITY_MACROS -DHAVE_FSMONITOR_DAEMON_BACKEND -Wmissing-prototypes" | ||
for f in $(grep WARNINGS RESULTS | awk {print\$2}); do | ||
echo "======================================================================" | ||
echo "=== $f ===" | ||
echo "======================================================================" | ||
sed -i '/#include "cache.h"/d' $f | ||
cat >temp.c <<-EOF && | ||
#include "git-compat-util.h" | ||
#include "$f" | ||
int main() {} | ||
EOF | ||
|
||
gcc -c $FLAGS -I. temp.c | ||
git checkout -q HEAD $f | ||
done |