Re: pgindent run coming

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgindent run coming
Date: 2009-06-10 18:24:38
Message-ID: 200906101824.n5AIOcV21199@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > OK, I have found the cause of the script error, and it was my fault. A
> > month after we ran pgindent for 8.3 (December 2007), I received this
> > issue from Tom:
>
> > http://archives.postgresql.org/pgsql-hackers/2007-12/msg00800.php
> >> Something I noticed the other day is that pgindent doesn't seem to treat
> >> "struct foo" or "union foo" as a type name, which is pretty silly
> >> because no context is needed at all to recognize that.
>
> Ah. So really the point here is that we want to specifically exclude
> "struct stat" because there are too many places in our code where "stat"
> is used as a regular identifier. Are there any other special cases like
> that?

Yep, lots. I see "option" also doing strange things, and some others.
You can see the diff here:

http://momjian.us/expire/pgindent/http://momjian.us/expire/pgindent/

Basically that list is meant for typedefs, not struct or union tags.
The BSD indent manual page says:

-Ttypename Adds typename to the list of type keywords. Names accu-
mulate: -T can be specified more than once. You need to
specify all the typenames that appear in your program
that are defined by typedef - nothing will be harmed if
you miss a few, but the program won't be formatted as
nicely as it should. This sounds like a painful thing to
have to do, but it's really a symptom of a problem in C:
typedef causes a syntactic change in the language and
indent can't find all instances of typedef.

I am unclear why struct pointers are not being formatted properly in
function headers but will research it.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2009-06-10 18:26:23 Re: Multicolumn index corruption on 8.4 beta 2
Previous Message Tom Lane 2009-06-10 18:23:09 Re: Resolving 8.4 open items