diff --git a/src/tools/pgindent/README b/src/tools/pgindent/README new file mode 100644 index e81e85d..7504650 *** a/src/tools/pgindent/README --- b/src/tools/pgindent/README *************** pgindent *** 6,31 **** This can format all PostgreSQL *.c and *.h files, but excludes *.y, and *.l files. ! 1) Change directory to the top of the build tree. ! 2) Download the typedef file from the buildfarm: wget -O src/tools/pgindent/typedefs.list http://buildfarm.postgresql.org/cgi-bin/typedefs.pl ! 3) Remove all derived files (pgindent has trouble with one of the flex macros): gmake maintainer-clean ! 4) Run pgindent: find . -name '*.[ch]' -type f -print | \ egrep -v -f src/tools/pgindent/exclude_file_patterns | \ xargs -n100 pgindent src/tools/pgindent/typedefs.list ! 5) Remove any files that generate errors and restore their original versions. ! 6) Do a full test build: run configure # stop is only necessary if it's going to install in a location with an --- 6,33 ---- This can format all PostgreSQL *.c and *.h files, but excludes *.y, and *.l files. ! 1) Install pg_bsd_indent (see below for details) ! 2) Change directory to the top of the build tree. ! ! 3) Download the typedef file from the buildfarm: wget -O src/tools/pgindent/typedefs.list http://buildfarm.postgresql.org/cgi-bin/typedefs.pl ! 4) Remove all derived files (pgindent has trouble with one of the flex macros): gmake maintainer-clean ! 5) Run pgindent: find . -name '*.[ch]' -type f -print | \ egrep -v -f src/tools/pgindent/exclude_file_patterns | \ xargs -n100 pgindent src/tools/pgindent/typedefs.list ! 6) Remove any files that generate errors and restore their original versions. ! 7) Do a full test build: run configure # stop is only necessary if it's going to install in a location with an *************** This can format all PostgreSQL *.c and * *** 38,54 **** --------------------------------------------------------------------------- ! We have standardized on NetBSD's indent. We have fixed a few bugs which ! requre the NetBSD source to be patched with indent.bsd.patch patch. A ! fully patched version is available at ftp://ftp.postgresql.org/pub/dev. GNU indent, version 2.2.6, has several problems, and is not recommended. These bugs become pretty major when you are doing >500k lines of code. If you don't believe me, take a directory and make a copy. Run pgindent on the copy using GNU indent, and do a diff -r. You will see what I ! mean. GNU indent does some things better, but mangles too. ! Notes about excluded files: src/include/storage/s_lock.h is excluded because it contains assembly code that pgindent tends to mess up. --- 40,67 ---- --------------------------------------------------------------------------- ! BSD indent ! ---------- ! ! We have standardized on NetBSD's indent, and renamed it pg_bsd_indent. ! We have fixed a few bugs which requre the NetBSD source to be patched ! with indent.bsd.patch patch. A fully patched version is available at ! ftp://ftp.postgresql.org/pub/dev. GNU indent, version 2.2.6, has several problems, and is not recommended. These bugs become pretty major when you are doing >500k lines of code. If you don't believe me, take a directory and make a copy. Run pgindent on the copy using GNU indent, and do a diff -r. You will see what I ! mean. GNU indent does some things better, but mangles too. For details, ! see: ! http://archives.postgresql.org/pgsql-hackers/2003-10/msg00374.php ! http://archives.postgresql.org/pgsql-hackers/2011-04/msg01436.php ! ! --------------------------------------------------------------------------- ! ! Notes about excluded files ! -------------------------- src/include/storage/s_lock.h is excluded because it contains assembly code that pgindent tends to mess up. *************** should not be changed. *** 63,70 **** --------------------------------------------------------------------------- ! Obsolete typedef list creation instructions: ! -------------------------------------------- To use pgindent: --- 76,83 ---- --------------------------------------------------------------------------- ! Obsolete typedef list creation instructions ! ------------------------------------------- To use pgindent: diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent new file mode 100755 index 05f69ef..eeb6f5d *** a/src/tools/pgindent/pgindent --- b/src/tools/pgindent/pgindent *************** fi *** 21,32 **** TYPEDEFS="$1" shift ! if [ -z "$INDENT" ] ! then ! INDENT=indent ! fi trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15 entab /dev/null if [ "$?" -ne 0 ] then echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2 --- 21,32 ---- TYPEDEFS="$1" shift ! [ -z "$INDENT" ] && INDENT=pg_bsd_indent trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15 + + # check the environment + entab /dev/null if [ "$?" -ne 0 ] then echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2 *************** then echo "Go to the src/tools/entab dir *** 36,42 **** fi $INDENT -? /dev/null 2>&1 if [ "$?" -ne 1 ] ! then echo "You do not appear to have 'indent' installed on your system." >&2 exit 1 fi $INDENT -gnu /dev/null 2>&1 --- 36,46 ---- fi $INDENT -? /dev/null 2>&1 if [ "$?" -ne 1 ] ! then echo "You do not appear to have '$INDENT' installed on your system." >&2 ! exit 1 ! fi ! if [ "`$INDENT -V`" != "$INDENT 1.0" ] ! then echo "You do not appear to have $INDENT version 1.0 installed on your system." >&2 exit 1 fi $INDENT -gnu /dev/null 2>&1 *************** do *** 140,149 **** # Protect wrapping in CATALOG(). sed 's;^CATALOG(.*$;/*&*/;' >/tmp/$$a # We get the list of typedef's from /src/tools/find_typedef $INDENT -bad -bap -bc -bl -d0 -cdb -nce -nfc1 -di12 -i4 -l79 \ ! -lp -nip -npro -bbb $EXTRA_OPTS \ ! `egrep -v '^(FD_SET|date|interval|timestamp|ANY)$' "$TYPEDEFS" | sed -e '/^$/d' -e 's/.*/-T& /'` \ /tmp/$$a >/tmp/$$ 2>&1 if [ "$?" -ne 0 -o -s /tmp/$$ ] --- 144,154 ---- # Protect wrapping in CATALOG(). sed 's;^CATALOG(.*$;/*&*/;' >/tmp/$$a + egrep -v '^(FD_SET|date|interval|timestamp|ANY)$' "$TYPEDEFS" | sed -e '/^$/d' > /tmp/$$b + # We get the list of typedef's from /src/tools/find_typedef $INDENT -bad -bap -bc -bl -d0 -cdb -nce -nfc1 -di12 -i4 -l79 \ ! -lp -nip -npro -bbb $EXTRA_OPTS -U/tmp/$$b \ /tmp/$$a >/tmp/$$ 2>&1 if [ "$?" -ne 0 -o -s /tmp/$$ ]