head	1.11;
access;
symbols
	REL7_0_PATCHES:1.9.0.2
	REL7_0:1.9;
locks; strict;
comment	@# @;


1.11
date	2000.06.14.22.28.16;	author momjian;	state dead;
branches;
next	1.10;

1.10
date	2000.05.29.17.40.45;	author momjian;	state Exp;
branches;
next	1.9;

1.9
date	99.07.17.15.37.30;	author momjian;	state Exp;
branches;
next	1.8;

1.8
date	99.07.17.04.00.31;	author momjian;	state Exp;
branches;
next	1.7;

1.7
date	99.07.16.17.46.32;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	99.07.16.17.07.40;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	99.07.15.22.40.16;	author momjian;	state Exp;
branches;
next	1.4;

1.4
date	99.07.15.20.32.30;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	99.07.15.19.21.43;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	99.07.15.16.55.32;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	99.07.15.15.21.52;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.11
log
@Update include scripts
@
text
@:
# report which files have extra includes

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' |
grep -v '\./config.h' |
grep -v '\./c.h' |
while read FILE
do
	if [ "`echo $FILE | sed -n 's/^.*\.\([^\.]*\)$/\1/p'`" = "h" ]
	then	IS_INCLUDE="Y"
	else	IS_INCLUDE="N"
	fi

	if [ "$IS_INCLUDE" = "Y" ]
	then	cat "$FILE" | grep -v "^#if" | grep -v "^#else" | 
		grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
	else	cat "$FILE" >/tmp/$$a
	fi
	cat /tmp/$$a | grep "^#include" |
	sed 's/^#include[ 	]*[<"]\([^>"]*\).*$/\1/g' |
	while read INCLUDE
	do
		[ -s /usr/include/$INCLUDE ] && continue
		[ "$INCLUDE" = postgres.h ] && continue
		[ "$INCLUDE" = config.h ] && continue
		[ "$INCLUDE" = c.h ] && continue
		# preserve configure-specific includes
		grep -B1 '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
		     egrep -q '^#if|^#else' && continue		
		grep -A1 '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
		     egrep -q '^#else|^#endif' && continue		
		cat /tmp/$$a |
		grep -v '^#include[ 	]*[<"]'"$INCLUDE"'[>"]' >/tmp/$$b
		if [ "$IS_INCLUDE" = "Y" ]
		then	echo "#include \"postgres.h\"" >/tmp/$$.c
		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 -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[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" >/tmp/$$b
				mv /tmp/$$b "$FILE"
				# reload after #include removal
				if [ "$IS_INCLUDE" = "Y" ]
				then	cat "$FILE" | grep -v "^#if" | grep -v "^#else" | 
					grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
				else	cat "$FILE" >/tmp/$$a
				fi
			fi
			if [ "$1" = "-v" ]
			then	cat /tmp/$$
				cat /tmp/$$.c
			fi
		fi
	done
done
@


1.10
log
@Split vacuum and analyze into separate files
@
text
@@


1.9
log
@Add c.h to exclusion list.
@
text
@d2 2
@


1.8
log
@Add config.h as needed.
@
text
@d6 1
d26 1
@


1.7
log
@More cleanup
@
text
@d3 3
a5 1
find . \( -name CVS -a -prune \) -o -type f -print | grep -v '\./postgres.h' |
d24 1
@


1.6
log
@More cleanup
@
text
@d23 4
a26 2
		grep -B1 -A1 -q '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' |
		     egrep -q '^#if|^#else|^#endif' && continue		
@


1.5
log
@Remove unused #includes in *.c files.
@
text
@d22 3
@


1.4
log
@Cleanups.
@
text
@d39 1
a39 1
			then	grep -v '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' $FILE >/tmp/$$b
d41 6
@


1.3
log
@Remove un-needed #include's from *.c files.
@
text
@d17 1
a17 1
	sed 's/#include[ 	]*[<"]\([^>"]*\).*$/\1/g' |
d39 1
a39 1
			then	grep -v '#include[ 	]*[<"]$INCLUDE[>"]' $FILE >/tmp/$$b
@


1.2
log
@Add updates.
@
text
@d3 1
a3 1
find . \( -name CVS -a -prune \) -o -type f -print | grep -v postgres.h |
d21 1
d29 1
d35 1
a35 1
		cc -Werror -Wall -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
d39 2
a40 2
			then	grep -v '#include[ 	]*[<"]$FILE[>"]' >/tmp/$$a
				mv /tmp/$$a "$FILE"
@


1.1
log
@Clean up #include in /include directory.  Add scripts for checking includes.
@
text
@d3 2
a4 1
find . \( -name CVS -a -prune \) -o -type f -print | while read FILE
d6 7
a12 1
	cat "$FILE" | grep -v "^#if" | grep -v "^#else" | 
d14 2
d23 4
a26 1
		echo "#include \"postgres.h\"" >/tmp/$$.c
d28 4
a31 2
		echo "void main() {" >>/tmp/$$.c
		pgdefine "$FILE" >>/tmp/$$.c
d36 4
@

