Re: pgindent behavior we could do without

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: pgindent behavior we could do without
Date: 2014-01-31 03:44:21
Message-ID: 20140131034421.GA12325@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 30, 2014 at 01:52:55PM -0500, Bruce Momjian wrote:
> On Thu, Jan 30, 2014 at 01:46:34PM -0500, Tom Lane wrote:
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > On Thu, Jul 18, 2013 at 12:27:21AM -0400, Tom Lane wrote:
> > >> I assert that we should simply remove both of these bits of code, as
> > >> just about every committer on the project is smarter about when to use
> > >> vertical whitespace than this program is.
> >
> > > OK, I have developed the attached patch that shows the code change of
> > > removing the test for #else/#elif/#endif. You will see that the new
> > > output has odd blank lines for cases like:
> >
> > > #ifndef WIN32
> > > static int copy_file(const char *fromfile, const char *tofile, bool force);
> > > -->
> > > #else
> > > static int win32_pghardlink(const char *src, const char *dst);
> > > -->
> > > #endif
> >
> > Hm. So actually, that code is trying to undo excess vertical whitespace
> > that something earlier in pgindent added? Where is that happening?
>
> I am afraid it is _inside_ BSD indent, and if ever looked at that code,
> you would not want to go in there. :-O

OK, seven hours later, I have fixed pg_bsd_indent to no longer insert
blank lines above #elif/#else/#endif, and therefore removed the special
case code from pgindent.

You will need to download version 1.3 of pg_bsd_indent for this to work,
and pgindent will complain if it doesn't find the right pg_bsd_indent
version.

Do we need to go an clean up any places where pgindent has suppressed
blank lines above #elif/#else/#endif in the past?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-01-31 03:54:48 Re: Issue with PGC_BACKEND parameters
Previous Message Amit Langote 2014-01-31 03:28:09 Re: Regarding google summer of code