Re: pgindent && weirdness

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
Subject: Re: pgindent && weirdness
Date: 2020-01-16 20:54:08
Message-ID: CA+hUKGJqy2Vy5pLzHg70=LivBUbFVALmcZ0OLBkJa9-iSq7wLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 16, 2020 at 3:59 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Wed, Jan 15, 2020 at 11:30 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Yeah, it's been doing that for decades. I think the triggering
> > factor is the typedef name (Var, here) preceding the &&.

Here's a better fix:

diff --git a/indent.c b/indent.c
index 9faf57a..51a60a6 100644
--- a/indent.c
+++ b/indent.c
@@ -570,8 +570,11 @@ check_type:
ps.in_or_st = false; /* turn off flag for structure decl or
* initialization */
}
- /* parenthesized type following sizeof or offsetof is not a cast */
- if (ps.keyword == 1 || ps.keyword == 2)
+ /*
+ * parenthesized type following sizeof or offsetof is
not a cast;
+ * likewise for function-like macros that take a type
+ */
+ if (ps.keyword == 1 || ps.keyword == 2 || ps.last_token == ident)
ps.not_cast_mask |= 1 << ps.p_l_follow;
break;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-01-16 21:05:52 Re: psql - add SHOW_ALL_RESULTS option
Previous Message Tomas Vondra 2020-01-16 20:53:07 Re: psql - add SHOW_ALL_RESULTS option