pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Piotr Stefaniak <postgres@piotr-stefaniak.me>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
Date: Tue, 13 Jun 2017 16:23:39 -0400
Message-ID: <29276.1497385419@sss.pgh.pa.us> (raw)
In-Reply-To: <24365.1497370969@sss.pgh.pa.us>
References: <20170517171600.fyxl3lhseszeuqrx@alvherre.pgsql>
	<AM3PR03MB1188858CCD55BC737C856F65F2E70@AM3PR03MB1188.eurprd03.prod.outlook.com>
	<880.1495045872@sss.pgh.pa.us>
	<VI1PR03MB119946C58CB0DD179DE43AD7F2E70@VI1PR03MB1199.eurprd03.prod.outlook.com>
	<5316.1495051919@sss.pgh.pa.us>
	<VI1PR03MB11999517FAD86D2C02407272F2E70@VI1PR03MB1199.eurprd03.prod.outlook.com>
	<11874.1495057567@sss.pgh.pa.us>
	<VI1PR03MB119987EDC3126CD6A56CF29CF2E40@VI1PR03MB1199.eurprd03.prod.outlook.com>
	<15819.1495145176@sss.pgh.pa.us>
	<VI1PR03MB1199E65EFAE1C1EE8E02D040F2FB0@VI1PR03MB1199.eurprd03.prod.outlook.com>
	<51717.1495410614@sss.pgh.pa.us>
	<VI1PR03MB119959F4B65F000CA7CD9F6BF2CC0@VI1PR03MB1199.eurprd03.prod.outlook.com>
	<24365.1497370969@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

I've now done a round of comparisons of results of our old indent
with your current version.  There's still one serious bug in the latter:
it continues to misformat enum typedefs, for instance

*************** PG_FUNCTION_INFO_V1(pg_prewarm);
*** 33,40 ****
  typedef enum
  {
  	PREWARM_PREFETCH,
! 	PREWARM_READ,
! 	PREWARM_BUFFER
  } PrewarmType;
  
  static char blockbuffer[BLCKSZ];
--- 33,40 ----
  typedef enum
  {
  	PREWARM_PREFETCH,
! 		PREWARM_READ,
! 		PREWARM_BUFFER
  } PrewarmType;
  
  static char blockbuffer[BLCKSZ];

I spent some time trying to diagnose that, and what I found is that
while it's scanning the enum list, ps.in_decl is false, which causes
dump_line() to set ps.ind_stmt to true after the first line, which
causes later calls of compute_code_target() to add continuation_indent.
I was able to make the problem go away by making this change, which
reverts a change you'd apparently made since the old version of indent:

inline patch 1: freebsd_indent/indent.c (+1/-1 lines) download inline-1.patchdiff -ru /home/postgres/freebsd_indent/indent.c freebsd_indent/indent.c --- /home/postgres/freebsd_indent/indent.c 2017-06-13 11:53:59.474524563 -0400 +++ freebsd_indent/indent.c 2017-06-13 15:51:23.590319885 -0400 @@ -944,7 +944,7 @@ } ps.in_or_st = true; /* this might be a structure or initialization * declaration */ - ps.in_decl = ps.decl_on_line = ps.last_token != type_def; + ps.in_decl = ps.decl_on_line = true; if ( /* !ps.in_or_st && */ ps.dec_nest <= 0) ps.just_saw_decl = 2; prefix_blankline_requested = 0;
This also undoes a tendency of the new version to want to insert blank lines that weren't there before inside struct declarations, eg
inline patch 2: contrib/btree_gist/btree_macaddr8.c (+1/-0 lines) download inline-2.patch*** a/contrib/btree_gist/btree_macaddr8.c --- b/contrib/btree_gist/btree_macaddr8.c *************** typedef struct *** 12,17 **** --- 12,18 ---- { macaddr8 lower; macaddr8 upper; + /* make struct size = sizeof(gbtreekey16) */ } mac8KEY;
While I would not necessarily have quibbled with the addition of those blank lines, I'm just as happy not to have them forced on us. I could not find any places where reverting this change made the results worse, so I'm unclear on why you made it. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers Patches: download all (2 files, .tar.gz)

view thread (37+ messages)  latest in thread

Message-ID: <29276.1497385419@sss.pgh.pa.us>
Permalink:  ../29276.1497385419@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29276.1497385419@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, postgres@piotr-stefaniak.me, alvherre@2ndquadrant.com, peter.eisentraut@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
  In-Reply-To: <29276.1497385419@sss.pgh.pa.us>
  References: <20170517171600.fyxl3lhseszeuqrx@alvherre.pgsql> <AM3PR03MB1188858CCD55BC737C856F65F2E70@AM3PR03MB1188.eurprd03.prod.outlook.com> <880.1495045872@sss.pgh.pa.us> <VI1PR03MB119946C58CB0DD179DE43AD7F2E70@VI1PR03MB1199.eurprd03.prod.outlook.com> <5316.1495051919@sss.pgh.pa.us> <VI1PR03MB11999517FAD86D2C02407272F2E70@VI1PR03MB1199.eurprd03.prod.outlook.com> <11874.1495057567@sss.pgh.pa.us> <VI1PR03MB119987EDC3126CD6A56CF29CF2E40@VI1PR03MB1199.eurprd03.prod.outlook.com> <15819.1495145176@sss.pgh.pa.us> <VI1PR03MB1199E65EFAE1C1EE8E02D040F2FB0@VI1PR03MB1199.eurprd03.prod.outlook.com> <51717.1495410614@sss.pgh.pa.us> <VI1PR03MB119959F4B65F000CA7CD9F6BF2CC0@VI1PR03MB1199.eurprd03.prod.outlook.com> <24365.1497370969@sss.pgh.pa.us> <29276.1497385419@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox