Thread: Another pgindent gripe

Another pgindent gripe

From
Alvaro Herrera
Date:
Hi,

I have another gripe regarding pgindent.  Why does it change indenting
of function declarations?  An example is at the end.  I think it may be
thinking that declarations should be aligned using 8-spaces tabs.  Can
this be corrected?

It annoyed me just now, because I'm adjusting my vacuum patch and lots
of conflicts appeared because it chose to change the spacing.  A
pointless change for an automatic tool to make, if I must add, and one
that adds gratuituous work for the human wanting to do some real work.


Index: vacuum.c
===================================================================
RCS file: /home/alvherre/cvs/pgsql/src/backend/commands/vacuum.c,v
retrieving revision 1.316
retrieving revision 1.317
diff -c -r1.316 -r1.317
*** vacuum.c    3 Oct 2005 22:52:21 -0000    1.316
--- vacuum.c    15 Oct 2005 02:49:16 -0000    1.317
***************
*** 198,204 ****  /* non-export function prototypes */ static List *get_rel_oids(List *relids, const RangeVar *vacrel,
!                           const char *stmttype); static void vac_update_dbstats(Oid dbid,
TransactionIdvacuumXID,                    TransactionId frozenXID);
 
--- 198,204 ----  /* non-export function prototypes */ static List *get_rel_oids(List *relids, const RangeVar *vacrel,
!              const char *stmttype); static void vac_update_dbstats(Oid dbid,                    TransactionId
vacuumXID,                   TransactionId frozenXID);
 


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Another pgindent gripe

From
Tom Lane
Date:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> I have another gripe regarding pgindent.  Why does it change indenting
> of function declarations?

What it's doing is indenting the additional lines in the same way as
they'd be indented in the function definition, that is

static void foo(int p1,   int p2);

static void
foo(int p1,   int p2)
{ ...

I've always thought this was pretty stupid, too --- I think it'd look
nicer as

static void foo(int p1,               int p2);

But I dunno whether it is easily fixable.  It's always done that AFAIR.
        regards, tom lane


Re: Another pgindent gripe

From
Neil Conway
Date:
On Mon, 2005-07-11 at 09:19 -0300, Alvaro Herrera wrote:
> I have another gripe regarding pgindent.  Why does it change indenting
> of function declarations?

On a related note, most of these changes are completely bogus:

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c.diff?r1=1.152;r2=1.153

-Neil




Re: Another pgindent gripe

From
"Kevin Grittner"
Date:
Where someone is doing real work and pgindent creates so many
cosmetic changes for the current CVS repository, would it be
feasible to first commit a "whitespace only" noop revision, so that
real changes can be easily identified.  I have seen this approach
work well for others.

-Kevin


>>> Neil Conway <neilc@samurai.com>  >>>
On Mon, 2005-07-11 at 09:19 -0300, Alvaro Herrera wrote:
> I have another gripe regarding pgindent.  Why does it change indenting
> of function declarations?

On a related note, most of these changes are completely bogus:

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c.diff?r1=1.152;r2=1.153

-Neil



Re: Another pgindent gripe

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> On a related note, most of these changes are completely bogus:

> http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c.diff?r1=1.152;r2=1.153

Oy vey!  Why did it insert spaces after the stars in all those function
declarations?  That's certainly not in conformance with project style
... and I don't see it having happened elsewhere.

Seems like pgindent has suffered some significant regressions since the
8.0 run.  I thought it had not been changed much at all, but evidently
that's wrong.
        regards, tom lane


Re: Another pgindent gripe

From
"Chuck McDevitt"
Date:
Pgindent adds spaces after the stars if it doesn't recognize the thing
before the star as a typedef... Could it be that somehow the list of
typedefs included in pgindent got corrupted?

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
> owner@postgresql.org] On Behalf Of Tom Lane
> Sent: Monday, November 07, 2005 8:19 AM
> To: Neil Conway
> Cc: Bruce Momjian; Hackers
> Subject: Re: [HACKERS] Another pgindent gripe
>
> Neil Conway <neilc@samurai.com> writes:
> > On a related note, most of these changes are completely bogus:
>
> >
>
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_e
xe
> c.c.diff?r1=1.152;r2=1.153
>
> Oy vey!  Why did it insert spaces after the stars in all those
function
> declarations?  That's certainly not in conformance with project style
> ... and I don't see it having happened elsewhere.
>
> Seems like pgindent has suffered some significant regressions since
the
> 8.0 run.  I thought it had not been changed much at all, but evidently
> that's wrong.
>
>             regards, tom lane
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings




Re: Another pgindent gripe

From
Bruce Momjian
Date:
FYI, I am looking into all the reports of pgindent failures and will
have those fixed and a sample re-run diff posted in a few days.

---------------------------------------------------------------------------

Chuck McDevitt wrote:
> Pgindent adds spaces after the stars if it doesn't recognize the thing
> before the star as a typedef... Could it be that somehow the list of
> typedefs included in pgindent got corrupted?
> 
> > -----Original Message-----
> > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
> > owner@postgresql.org] On Behalf Of Tom Lane
> > Sent: Monday, November 07, 2005 8:19 AM
> > To: Neil Conway
> > Cc: Bruce Momjian; Hackers
> > Subject: Re: [HACKERS] Another pgindent gripe
> > 
> > Neil Conway <neilc@samurai.com> writes:
> > > On a related note, most of these changes are completely bogus:
> > 
> > >
> >
> http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_e
> xe
> > c.c.diff?r1=1.152;r2=1.153
> > 
> > Oy vey!  Why did it insert spaces after the stars in all those
> function
> > declarations?  That's certainly not in conformance with project style
> > ... and I don't see it having happened elsewhere.
> > 
> > Seems like pgindent has suffered some significant regressions since
> the
> > 8.0 run.  I thought it had not been changed much at all, but evidently
> > that's wrong.
> > 
> >             regards, tom lane
> > 
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073