1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Remove un-needed #include's from *.c files.

This commit is contained in:
Bruce Momjian
1999-07-15 19:21:43 +00:00
parent 353eb3dadf
commit fb38a5d8cf
4 changed files with 11 additions and 9 deletions

View File

@@ -5,10 +5,11 @@ do
sed 's/->[a-zA-Z0-9_\.]*//g' "$FILE" >/tmp/$$a
echo "#include \"postgres.h\"" >/tmp/$$.c
echo "#include \"/tmp/$$a\"" >>/tmp/$$.c
echo "void include_test(void);" >>/tmp/$$.c
echo "void include_test() {" >>/tmp/$$.c
pgdefine "$FILE" >>/tmp/$$.c
echo "}" >>/tmp/$$.c
cc -Werror -Wall -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
cc -fsyntax-only -Werror -Wall -Wmissing-prototypes -Wmissing-declarations -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
if [ "$?" -ne 0 ]
then echo "$FILE"
if [ "$1" = "-v" ]

View File

@@ -1,6 +1,6 @@
:
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
find . \( -name CVS -a -prune \) -o -type f -print | grep -v postgres.h |
find . \( -name CVS -a -prune \) -o -type f -print | grep -v '\./postgres.h' |
while read FILE
do
if [ "`echo $FILE | sed -n 's/^.*\.\([^\.]*\)$/\1/p'`" = "h" ]
@@ -18,6 +18,7 @@ do
while read INCLUDE
do
[ -s /usr/include/$INCLUDE ] && continue
[ "$INCLUDE" = postgres.h ] && continue
cat /tmp/$$a |
grep -v '^#include[ ]*[<"]'"$INCLUDE"'[>"]' >/tmp/$$b
if [ "$IS_INCLUDE" = "Y" ]
@@ -25,17 +26,18 @@ do
else >/tmp/$$.c
fi
echo "#include \"/tmp/$$b\"" >>/tmp/$$.c
echo "void include_test(void);" >>/tmp/$$.c
echo "void include_test() {" >>/tmp/$$.c
if [ "$IS_INCLUDE" = "Y" ]
then pgdefine "$FILE" >>/tmp/$$.c
fi
echo "}" >>/tmp/$$.c
cc -Werror -Wall -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
cc -fsyntax-only -Werror -Wall -Wmissing-prototypes -Wmissing-declarations -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
if [ "$?" -eq 0 ]
then echo "$FILE $INCLUDE"
if [ "$IS_INCLUDE" = "N" ]
then grep -v '#include[ ]*[<"]$FILE[>"]' >/tmp/$$a
mv /tmp/$$a "$FILE"
then grep -v '#include[ ]*[<"]$INCLUDE[>"]' $FILE >/tmp/$$b
mv /tmp/$$b "$FILE"
fi
if [ "$1" = "-v" ]
then cat /tmp/$$