Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKsLu-0005ls-Vi for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 20:23:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKsLu-00032l-Bu for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 20:23:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKsLr-0002ya-9q for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 20:23:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKsLo-0003ER-5K for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 20:23:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v5DKNdoW029278; Tue, 13 Jun 2017 16:23:39 -0400 From: Tom Lane To: Piotr Stefaniak cc: Alvaro Herrera , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.) In-reply-to: <24365.1497370969@sss.pgh.pa.us> References: <20170517171600.fyxl3lhseszeuqrx@alvherre.pgsql> <880.1495045872@sss.pgh.pa.us> <5316.1495051919@sss.pgh.pa.us> <11874.1495057567@sss.pgh.pa.us> <15819.1495145176@sss.pgh.pa.us> <51717.1495410614@sss.pgh.pa.us> <24365.1497370969@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 13 Jun 2017 12:22:49 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29275.1497385419.1@sss.pgh.pa.us> Date: Tue, 13 Jun 2017 16:23:39 -0400 Message-ID: <29276.1497385419@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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: diff -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 *** 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