I noticed that pgindent is doing weird things with function pointer
declarations; see for example what it did with AnalyzeAttrFetchFunc
and compute_stats in src/include/commands/vacuum.h.  I don't recall
that it was doing this before the latest run.

			regards, tom lane

Thu, 30 Sep 2004 13:22:08 -0400
Tom Lane <tgl@sss.pgh.pa.us>
More pgindent bizarreness
Tom Lane wrote:
> I noticed that pgindent is doing weird things with function pointer
> declarations; see for example what it did with AnalyzeAttrFetchFunc
> and compute_stats in src/include/commands/vacuum.h.  I don't recall
> that it was doing this before the latest run.

You mean here?

    void        (*compute_stats) (VacAttrStatsP stats,
                                          AnalyzeAttrFetchFunc fetchfunc,
                                              int samplerows,
                                              double totalrows);

I looked in 7.4.X CVS and I don't see this definition there so maybe it
was always weird.

Can you find a case that also had code in 7.4.X?

-- 
  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, Pennsylvania 19073

Thu, 30 Sep 2004 16:23:28 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: More pgindent bizarreness
Tom Lane wrote:
> I noticed that pgindent is doing weird things with function pointer
> declarations; see for example what it did with AnalyzeAttrFetchFunc
> and compute_stats in src/include/commands/vacuum.h.  I don't recall
> that it was doing this before the latest run.

Or do you mean here?

	typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum,
	                                                   bool *isNull);
	
I do see -TAnalyzeAttrFetchFunc as a flag in pgindent so it knows is it
is a typdef.

-- 
  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, Pennsylvania 19073

Thu, 30 Sep 2004 16:25:56 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: More pgindent bizarreness
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Or do you mean here?

Both, but the multi-line case with two different indent levels is
particularly strange.

You're right that this particular code is new in 8.0.  (Looks around...)
struct f_smgr in smgr.c is a comparable case, and it seems to have been
weirdly indented right along, so maybe it's an old bug.

			regards, tom lane

Thu, 30 Sep 2004 16:41:46 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: More pgindent bizarreness 
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Or do you mean here?
> 
> Both, but the multi-line case with two different indent levels is
> particularly strange.
> 
> You're right that this particular code is new in 8.0.  (Looks around...)
> struct f_smgr in smgr.c is a comparable case, and it seems to have been
> weirdly indented right along, so maybe it's an old bug.

Yes, that is what I am thinking.  I have worked around other bugs in the
C code before by doing things with the shell script though this problem
seems hard to clean up with a shell script.  I found GNU indent to be
even harder to fix.

-- 
  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, Pennsylvania 19073

Thu, 30 Sep 2004 16:48:31 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: More pgindent bizarreness
On Fri, 2004-10-01 at 06:48, Bruce Momjian wrote:
> Yes, that is what I am thinking.  I have worked around other bugs in the
> C code before by doing things with the shell script though this problem
> seems hard to clean up with a shell script.  I found GNU indent to be
> even harder to fix.

Have you taken a look at astyle? I haven't used it, but it might be
worth considering.

http://astyle.sourceforge.net/

-Neil



Wed, 06 Oct 2004 18:03:59 +1000
Neil Conway <neilc@samurai.com>
Re: More pgindent bizarreness
Neil Conway wrote:
> On Fri, 2004-10-01 at 06:48, Bruce Momjian wrote:
> > Yes, that is what I am thinking.  I have worked around other bugs in the
> > C code before by doing things with the shell script though this problem
> > seems hard to clean up with a shell script.  I found GNU indent to be
> > even harder to fix.
> 
> Have you taken a look at astyle? I haven't used it, but it might be
> worth considering.
> 
> http://astyle.sourceforge.net/

I did look at it a few years ago but not recently.  It might be better
but didn't seem to have the same number of controls as BSD indent.

-- 
  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, Pennsylvania 19073

Wed, 6 Oct 2004 04:27:18 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: More pgindent bizarreness