From: | Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_bsd_indent - improvements around offsetof and sizeof |
Date: | 2016-06-26 10:06:17 |
Message-ID: | BLU436-SMTP19D682003284BE777279BFF2200@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2016-05-27 08:13, Piotr Stefaniak wrote:
> I'm trying to see if FreeBSD indent can successfully do pg_bsd_indent's
> job. So far I had to fix one thing, which is not adding a space after a
> cast operator, for which they added no option to turn it off. Currently
> I'm fighting one other bug, but I think that'll be it.
So... after fixing 12 times more bugs that I had anticipated (see the
list at the end of this email; also see attached patches.tgz if you want
to apply the patches yourself), my "fork" of FreeBSD indent(1) can do
pg_bsd_indent's job if you pass it three additional parameters (-nut
-cli1 -sac), producing a 6600-line unified diff, mostly of desired
changes (see freebsd-indent.diff.gz for details).
I'm in the process of pushing my changes upstream, but I was already
told that it's too late to get them into 11.0-RELEASE. Personally, I
don't mind that, hoping that the upstream will accept them eventually.
> I'm also hoping it'll be easier to reinvent GNU indent's -tsn ("set
> tabsize to n spaces") option for FreeBSD indent than it would be for
> any other of the forks that aren't GNU. I envision that to be the
> first step to getting rid of some of the work-arounds pgindent does,
> mainly running entab and detab as pre- and post-processing steps.
That and more I'll probably do later.
> If porting FreeBSD indent to PostgreSQL's sources turns out to be
> successful, there will be a choice between rebasing pg_bsd_indent on
> that and picking specific patches and applying it on PG's fork of
> indent(1).
At this point I think it wouldn't make any sense to port any changes to
current pg_bsd_indent.
The full list of changes I made to FreeBSD's indent(1) as of r289677:
[bugfix] Fix typo in keyword "typedef".
[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.
[bugfix] Avoid potential use-after-free.
[bugfix] Semicolons inside struct declarations don't end the
declarations.
[bugfix] Support "f" and "F" floating constant suffixes.
[bugfix] Removed whitespace shouldn't be considered in column
calculations.
[bugfix] Don't add surplus space on empty lines in comments.
[bugfix] Bail out if there's no more space on the parser stack.
[bugfix] Consistently indent declarations.
[bugfix] Don't ignore the fact that offsetof is a keyword.
[cleanup] Make definition of opchar conditional.
[cleanup] Remove dead code relating to unix-style comments.
[cleanup] Simplify pr_comment().
[cleanup] Deduplicate code that decided if a comment needs a
blank line at the top.
[bugfix] Fix wrapping of some lines in comments.
[bugfix] Untangle the connection between pr_comment.c and io.c,
fixing at least two bugs
[feature] Add -sac (space after cast) and -nsac options.
[bugfix] Don't newline on cpp lines like #endif unless -bacc is on.
[feature] Add -U option for providing a file containing list of
types.
[optimization] Use bsearch() for looking up type keywords.
Attachment | Content-Type | Size |
---|---|---|
freebsd-indent.diff.gz | application/gzip | 49.6 KB |
patches.tgz | application/x-compressed-tar | 19.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Piotr Stefaniak | 2016-06-26 10:19:39 | Re: A couple of cosmetic changes around shared memory code |
Previous Message | David Rowley | 2016-06-26 06:46:01 | Re: Rethinking representation of partial-aggregate steps |