aboutsummaryrefslogtreecommitdiff
path: root/src/tools/pgindent/README
blob: fa77458354776cf33d4fd753e9e7752ef14bedd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$PostgreSQL: pgsql/src/tools/pgindent/README,v 1.39 2010/02/26 18:00:15 momjian Exp $

pgindent
========

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 builfarm:

	wget -O src/tools/pgindent/typedefs.list http://www.pgbuildfarm.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 '/s_lock.h|/ecpg/test/expected/|/snowball/libstemmer/' |
	egrep -v '/ecpg/include/(sqlda|sqltypes)\.h$' |
	egrep -v '/ecpg/include/preproc/struct\.h$' |
	xargs -n100 pgindent src/tools/pgindent/typedefs.list

5) Remove any files that generate errors.

6) Do a full test build:

	gmake installcheck-world


---------------------------------------------------------------------------

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.

src/include/snowball/libstemmer/ and src/backend/snowball/libstemmer/
are excluded because those files are imported from an external project,
not maintained locally, and are machine-generated anyway.

src/interfaces/ecpg/test/expected/ is excluded to avoid breaking the ecpg
regression tests.  Several *.h files are included in regression output so
should not be changed.

---------------------------------------------------------------------------

Obsolete typedef list creation instructions:
--------------------------------------------

To use pgindent:

1) Build the source tree with _debug_ symbols and all possible configure options

2) Install to /usr/local/pgsql

3) Install all contrib modules

4) Save a list of typedefs by running:

	src/tools/find_typedef /usr/local/pgsql/bin /usr/local/pgsql/lib > /tmp/pgtypedefs