On Thu, May 16, 2019 at 9:17 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > I wrote: > > I experimented with fixing this. I was able to get pg_bsd_indent to > > distinguish multi-line function declarations from definitions, but it > > turns out that it doesn't help your concern about the lines being too > > long after re-indenting. Contrary to what you imagine above, it seems > > pg_bsd_indent will not reflow argument lists, regardless of whether it > > thinks there needs to be more or less leading whitespace. > > Actually, now that I think about it, pgindent seldom revisits line-break > decisions in code anyway; it's only aggressive about reflowing comments. > So maybe we shouldn't be expecting it to fix this.
Ahh, so my quick and dirty perl change was probably OK then. Sorry I didn't realise that before, but this certainly a better way, fixing the right thing. > A small problem with the "rejiggering" is that it now makes the wrong > choice for K&R-style function definitions, causing them to be weirdly > indented. For our purposes, that's a non-problem so I'm not excited > about trying to make it smart enough to recognize those. We do have > a couple of amazingly old and crufty K&R-style functions in src/port/, > though, so probably we'd wish to fix those. What kid of fork is pg_bsd_indent... do we care about upstreaming changes? I guess someone would need to deal with that case eventually if so. > Attached is working draft of pg_bsd_indent changes (still sans comments) > as well as a patch showing the difference between current pgindent > results on HEAD and the results of this version. I think there's no > question that this is an improvement. +1 Thanks for looking into it! -- Thomas Munro https://enterprisedb.com