Re: pgindent && weirdness

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
Subject: Re: pgindent && weirdness
Date: 2020-02-17 15:35:25
Message-ID: 20200217153525.GA14354@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Feb-17, Thomas Munro wrote:

> Thinking about this again: It's obviously not true that everything
> that looks like a function call is not a cast. You could have
> "my_cast(Type)" that expands to "(Type)" or some slightly more useful
> variant of that, and then "my_cast(Type) -1" would, with this patch
> applied, be reformatted as "my_cast(Type) - 1" because it'd err on the
> side of thinking that the expression produces a value and therefore
> the minus sign must be a binary operator that needs whitespace on both
> sides, and that'd be wrong. However, it seems to me that macros that
> expand to raw cast syntax (and I mean just "(Type)", not a complete
> cast including the value to be cast, like "((Type) (x))") must be rare
> and unusual things, and I think it's better to err on the side of
> thinking that function-like macros are values, not casts. That's all
> the change does, and fortunately the authors of indent showed how to
> do that with their existing special cases for offsetof and sizeof; I'm
> just extending that treatment to any identifier.

Hmm ... this suggests to me that if you remove these alleged special
cases for offsetof and sizeof, the new code handles them correctly
anyway. Do you think it's worth giving that a try? Not because
removing the special cases would have any value, but rather to see if
anything interesting pops up.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Muhammad Usama 2020-02-17 15:39:11 Re: [HACKERS] Transactions involving multiple postgres foreign servers, take 2
Previous Message Peter Eisentraut 2020-02-17 15:16:40 Re: Optimize update of tables with generated columns