Re: pgindent run?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Mark Dilger <hornschnorter(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgindent run?
Date: 2018-01-24 18:32:29
Message-ID: 20180124183229.pymzlkoa2wtpdlen@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-01-23 22:22:47 -0500, Bruce Momjian wrote:
> On Tue, Nov 28, 2017 at 04:38:12PM -0500, Tom Lane wrote:
> > Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
> > > On Wed, Nov 29, 2017 at 9:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > >> I think that'd be taking it too far, especially given that the dependency
> > >> on a typedefs list means that the git hook might have a different idea
> > >> of what's correctly indented than the committer does. It'd be very hard
> > >> to debug such discrepancies and figure out what would satisfy the hook.
> >
> > > Is there no way to get reasonable indentation that doesn't depend on
> > > that typedefs list?
> >
> > Perhaps, but not with the tool we've got.
> >
> > It's well known that C is unparseable without knowing which identifiers
> > are typedefs, so it doesn't exactly surprise me that it might not be
> > sanely indentable without knowing that. But I've not thought hard about
> > it, nor looked for alternate tools.
>
> For people curious about the C typedef parsing details:
>
> http://calculist.blogspot.com/2009/02/c-typedef-parsing-problem.html
> https://stackoverflow.com/questions/243383/why-cant-c-be-parsed-with-a-lr1-parser

FWIW, I think this problem could just as well be addressed with a few
printing heuristics instead of actually needing an actual list of
typedefs. There'd be one or two edge cases of bad formatting, but the
end result would be far less painful than what we have today, were
basically nobody can format their patches without a lot of manual
cherry-picking or large scale unrelated whitespace changes.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-01-24 18:35:41 Re: [PROPOSAL] Shared Ispell dictionaries
Previous Message Andres Freund 2018-01-24 18:28:41 Re: pgsql: Add parallel-aware hash joins.