Postgres developers use an older fork of indent(1) to indent their sources. I took FreeBSD's indent(1) and made the changes listed below, in hope that: 1) Postgres could use it and 2) it would be possible to push as many of these as possible upstream.
r301513 | [bugfix] | Fix typo in keyword "typedef". |
r303482 | [bugfix] | Avoid out of bound access of array codebuf pointed into by s_code. |
[bugfix] | Avoid out of bound access of array ps.paren_indents. | |
[bugfix] | Avoid out of bound access of array in_buffer. | |
r303483 | [bugfix] | Avoid potential use-after-free. |
r303484 | [bugfix] | Fix breakage caused by single comment following "else". |
[bugfix] | Avoid out of bound access of array ps.p_stack. | |
r303485 | [bugfix] | Semicolons inside struct declarations don't end the declarations. |
r303499 | [bugfix] | Support "f" and "F" floating constant suffixes. |
r303489 | [bugfix] | Removed whitespace shouldn't be considered in column calculations. |
r303571 | [bugfix] | Bail out if there's no more space on the parser stack. |
r303570 | [bugfix] | Consistently indent declarations. |
r303718 | [bugfix] | Don't ignore the fact that offsetof is a keyword. |
[cleanup] | Make definition of opchar conditional. | |
r303588 | [cleanup] | Remove dead code relating to unix-style comments. |
r303596 | [cleanup] | Simplify pr_comment(). |
r303596 | [cleanup] | Deduplicate code that decided if a comment needs a blank line at the top. |
r303597 | [bugfix] | Fix wrapping of some lines in comments. |
r303598 | [bugfix] | Untangle the connection between pr_comment.c and io.c, fixing at least two bugs. |
r303599 | [bugfix] | Don't newline on cpp lines like #endif unless -bacc is on. |
r303735 | [feature] | Add -sac (space after cast) and -nsac options. |
r303735 | [feature] | Add -U option for providing a file containing list of types. |
r303746 | [optimization] | Use bsearch() for looking up type keywords. |
[style] | return (var). | |
[style] | sizeof(var). | |
r303600 | [cleanup] | replace function call to bzero with memset. |
[cleanup] | Remove dead assignment. | |
r303601 | [cleanup] | Rearrange option parsing code a bit to avoid complaints from static analyzers. |
[style] | Conform to FreeBSD's style(9). | |
r303629 | [bugfix] | Avoid using values of pointers that refer to deallocated space. |
I do possess separate patch files for when they are needed. My work on indent(1) is also available at https://github.com/pstef/freebsd_indent/commits/pass1