Hi,

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);

even though the same pattern works, and is used fairly widely for assignments

        amroutine->amparallelvacuumoptions =
                VACUUM_OPTION_PARALLEL_BULKDEL;

Particularly when variable and/or types names are longer, it's sometimes hard
to fit enough into one line to use a different style. E.g., the code I'm
currently hacking on has

            RWConflict  possibleUnsafeConflict = 
dlist_container(RWConflictData, inLink, iter.cur);

There's simply no way to make break that across lines that doesn't either
violate the line length limit or makes pgindent do odd things:

too long line:
            RWConflict  possibleUnsafeConflict = dlist_container(RWConflictData,
                                                                 inLink,
                                                                 iter.cur);

pgindent will move start of second line:
            RWConflict  possibleUnsafeConflict =
                dlist_container(RWConflictData, inLink, iter.cur);

I know I can leave the variable initially uninitialized and then do a separate
assignment, but that's not a great fix. And sometimes other initializations
want to access the variable alrady.


Do others dislike this as well?

I assume we'd again have to dive into pg_bsd_indent's code to fix it :(

And even if we were to figure out how, would it be worth the
reindent-all-branches pain? I'd say yes, but...

Greetings,

Andres Freund


Reply via email to