bsd indent
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.
. the file is a compressed tar file - it would be better to have a file
extension of .tgz or .tar.gz instead of just .gz, so that this is apparent.
. 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.
cheers
andrew
Attachments:
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?
. the file is a compressed tar file - it would be better to have a file
extension of .tgz or .tar.gz instead of just .gz, so that this is apparent.
Done. Sorry.
. 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.
--
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
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@Thor indent]$ make clean
rm -f *.o indent log core
[andrew@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@Thor indent]$ make clean
rm -f *.o indent log core
[andrew@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@Thor indent]$
cheers
andrew
Andrew Dunstan wrote:
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;
Yes, this is exactly what I remember, and I can think of no way to
"script" that fix.
Let me know when you can download. I sure it will hit the mirrors
shortly.
The fact that we have a way to auto-indent 450k lines of C code with
few/no complaints is amazing in itself.
--
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
BTW, there's a bug in entab.c, too. This line:
#include "../include/c.h"
should read
#include "../../include/c.h"
cheers
andrew
Andrew Dunstan wrote:
BTW, there's a bug in entab.c, too. This line:
#include "../include/c.h"
should read
#include "../../include/c.h"
Thanks. Fixed.
--
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