Re: pgindent && weirdness - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: pgindent && weirdness
Date
Msg-id CA+hUKGJqy2Vy5pLzHg70=LivBUbFVALmcZ0OLBkJa9-iSq7wLQ@mail.gmail.com
Whole thread Raw
In response to Re: pgindent && weirdness  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: pgindent && weirdness  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Thu, Jan 16, 2020 at 3:59 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Jan 15, 2020 at 11:30 AM Tom Lane <tgl@sss.pgh.pa.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;



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: psql - add SHOW_ALL_RESULTS option
Next
From: Alvaro Herrera
Date:
Subject: Re: psql - add SHOW_ALL_RESULTS option