Re: pgindent vs variable declaration across multiple lines - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pgindent vs variable declaration across multiple lines
Date
Msg-id 20230120231201.5646hisbf6q5grcb@awork3.anarazel.de
Whole thread Raw
In response to Re: pgindent vs variable declaration across multiple lines  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2023-01-19 17:59:49 -0800, Andres Freund wrote:
> On 2023-01-19 20:43:44 -0500, Tom Lane wrote:
> > Andres Freund <andres@anarazel.de> writes:
> > > There's a few places in the code that try to format a variable definition like this
> >
> > >     ReorderBufferChange *next_change =
> > >         dlist_container(ReorderBufferChange, node, next);
> >
> > > but pgindent turns that into
> >
> > >     ReorderBufferChange *next_change =
> > >     dlist_container(ReorderBufferChange, node, next);
> >
> > Yeah, that's bugged me too.  I suspect that the triggering factor is
> > use of a typedef name within the assigned expression, but I've not
> > tried to run it to ground.
>
> It's not that - it happens even with just
>     int frak =
>         1;
>
> since it doesn't happen for plain assignments, I think it's somehow related to
> code dealing with variable declarations.

Another fun one: pgindent turns

    return (instr_time) {t.QuadPart};
into
    return (struct instr_time)
    {
        t.QuadPart
    };

Obviously it can be dealt with with a local variable, but ...

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: feature request: IN clause optimized through append nodes with UNION ALL
Next
From: Robert Haas
Date:
Subject: Re: pgindent vs variable declaration across multiple lines