Re: bsd indent

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bsd indent
Date: 2003-10-07 17:23:57
Message-ID: 3F82F6AD.4050905@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:

>Andrew Dunstan wrote:
>
>
>>I grabbed the patched BSD indent from a mirror. Here's a couple of points:
>>
>>. with a little trial and error GNU indent 2.2.9 actually did quite a
>>reasonable job for me last night. But I guess YMMV. I'm curious to know
>>what nasty mangling it does.
>>
>>
>
>GNU indent does a reasonable job, but it did some strange spacing for
>function definitions, if I remember correctly. Can you test by running
>pgindent and gnuindent through the /executor files and do a diff to see
>the differences in formatting?
>

after I added -ncdb to the GNU indent options in pgindent, the main
effect appears to be that it joins function calls across lines,
sometimes in weird ways. I guess that's bad enough for us not to use it
unless someone knows a way to turn that off.

Example (second case is bsd indented):

***************
*** 217,223 ****
execTuplesHashPrepare(TupleDesc tupdesc,
int numCols,
AttrNumber *matchColIdx,
! FmgrInfo **eqfunctions, FmgrInfo **hashfunctions)
{
int i;

--- 234,241 ----
execTuplesHashPrepare(TupleDesc tupdesc,
int numCols,
AttrNumber *matchColIdx,
! FmgrInfo **eqfunctions,
! FmgrInfo **hashfunctions)
{
int i;

>>. I had to hack the makefile for my linux box for a reasonably clean
>>build, so that the CFLAGS on the install line doesn't override setting
>>the defines, and the compiler won't complain about isblank and/or strdup
>>and/or fileno. The diff is attached for anyone interested.
>>
>>
>
>OK, I updated it on the ftp site. Can you download it? It should have
>size 41192. Is _GNU_SOURCE required? I didn't add that, but fixed the
>install part.
>
>
>

I am being refused connection to developer.postgresql.org and it hasn't
reached the mirrors yet AFAICS.

Here's what happens on my RH9 box if you don't define _GNU_SOURCE:
[andrew(at)Thor indent]$ make clean
rm -f *.o indent log core
[andrew(at)Thor indent]$ make XFLAGS='-D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright="'
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall args.c
args.c:71: warning: `rcsid' defined but not used
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall indent.c
indent.c:68: warning: `copyright' defined but not used
indent.c:78: warning: `rcsid' defined but not used
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall io.c
io.c:71: warning: `rcsid' defined but not used
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall lexi.c
lexi.c:71: warning: `rcsid' defined but not used
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall parse.c
parse.c:71: warning: `rcsid' defined but not used
cc -c -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char
*copyright=" -g -Wall pr_comment.c
pr_comment.c: In function `pr_comment':
pr_comment.c:409: warning: implicit declaration of function `isblank'
pr_comment.c: At top level:
pr_comment.c:71: warning: `rcsid' defined but not used
cc -o indent -g -Wall args.o indent.o io.o lexi.o parse.o pr_comment.o
[andrew(at)Thor indent]$ make clean
rm -f *.o indent log core
[andrew(at)Thor indent]$ make
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall args.c
args.c:71: warning: `rcsid' defined but not used
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall indent.c
indent.c:68: warning: `copyright' defined but not used
indent.c:78: warning: `rcsid' defined but not used
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall io.c
io.c:71: warning: `rcsid' defined but not used
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall lexi.c
lexi.c:71: warning: `rcsid' defined but not used
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall parse.c
parse.c:71: warning: `rcsid' defined but not used
cc -c -D_GNU_SOURCE -D__RCSID="static char *rcsid="
-D__COPYRIGHT="static char *copyright=" -g -Wall pr_comment.c
pr_comment.c:71: warning: `rcsid' defined but not used
cc -o indent -g -Wall args.o indent.o io.o lexi.o parse.o pr_comment.o
[andrew(at)Thor indent]$

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-10-07 17:28:41 Re: bsd indent
Previous Message Bruce Momjian 2003-10-07 16:58:24 Re: Disabling function validation