Re: pgindent run coming

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pgindent run coming
Дата
Msg-id 200906101601.n5AG12U27452@momjian.us
обсуждение исходный текст
Ответ на Re: pgindent run coming  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: pgindent run coming  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > I saw a few odd things.  Most importantly, it seems 'stat' was
> > > introduced as a typedef on _both_ lists, yielding weird changes like:
> > 
> > The standard headers do define "struct stat".  I wonder whether the
> > objdump kluge we are using is unable to distinguish typedef names
> > from struct tags.
> > 
> > > I will have to research this further tomorrow.
> > 
> > We don't have a lot of time for research.  Maybe the best thing is to
> > just manually remove stat from the typedef list (along with anything
> > else that clearly shouldn't be there)?
> 
> The problem is that there are other symbols I don't know about and the
> diff is very large. I have found that the problem was caused when we
> added Linux support to find_typedef and I have a way to get an accurate
> list on my machine.

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.  We tend not to
> do that too much --- the project style is to use a typedef name --- but
> there are some places that do it, particularly the regex code.  For
> instance there are extra spaces here:
> 
> static void
> cmtreefree(struct colormap * cm,
>            union tree * tree,
>            int level)            /* level number (top == 0) of this
> block */
> {
> 
> Fixable?

Not understanding the ramifications of adding struct and union tags to
the typedef list, I modified the BSD code:

http://archives.postgresql.org/pgsql-hackers/2007-12/msg00810.php
> Yes, I found those are 't' STABS rather than "T" which are used in cases
> where you do typedef struct {} name.  The next pgindent will have those
> typedefs you want.

and that modification was propogated to the Linux code.

This has now been fixed in the BSD and Linux code (and Perl script) and
we can move forward with running pgindent once Andrew has lists for all
the platforms he wants.

As for Tom's original complaint about, it seems BSD indent is just not
smart enough about struct/union tags.  I will look into fixing that
after 8.4 pgindent is run.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Albe Laurenz"
Дата:
Сообщение: Re: Problem with listen_addresses = '*' on 8.4beta2 on AIX
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Plan time Improvement - 64bit bitmapset