pgindent

Поиск
Список
Период
Сортировка
От Bernard Frankpitt
Тема pgindent
Дата
Msg-id 37D808A3.3E840A7C@pop.dn.net
обсуждение исходный текст
Ответы Re: [HACKERS] pgindent  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Hi All, 

I just tried to get pgindent to work and I ran into a few snags

1)

I tried the src/tools/pgindent/indent.bsd.patch on two recent
versions of bsd indent. One from the current version of openbsd, and
one from freebsd RELENG_3. In neither case the patch applied cleanly.


The code in indent around the area of the second patch segment 
*** 186,192 ****                               *e_token++ = *buf_ptr++;                       }               }
!           if (*buf_ptr == 'L' || *buf_ptr == 'l')               *e_token++ = *buf_ptr++;       }       else

now looks like this
           while (1) {               if (!(seensfx & 1) &&                       (*buf_ptr == 'U' || *buf_ptr == 'u'))
{                  CHECK_SIZE_TOKEN;                   *e_token++ = *buf_ptr++;                   seensfx |= 1;
         continue;               }               if (!(seensfx & 2) &&                       (*buf_ptr == 'L' ||
*buf_ptr== 'l')) {                   CHECK_SIZE_TOKEN;                   if (buf_ptr[1] == buf_ptr[0])
    *e_token++ = *buf_ptr++;                   *e_token++ = *buf_ptr++;                   seensfx |= 2;
 continue;               }               break;
 

Without understanding what the code is meant to do, I am guessing that
the second patch is no longer necessary.

Also, in the openbsd source the specials buffer is automatically
resized, so it seems that neither part of the patch is necessary for
recent openbsd sources.

2) 

I compiled and tried both bsd distributions. And ran into the
following problem with pgindent.

The test in pgindent for the gnu vesion doesn't work.

indent -version -npro </dev/null >/dev/null 2>&1
if [ "$?" -eq 0 ]
then    echo "You appear to have GNU indent rather than BSD indent." >&2       echo "See the pgindent/README file for a
descriptionof its
 
problems." >
&2       EXTRA_OPTS="-ncdb -bli0 -npcs -cli4"
else    echo "Hope you installed /src/tools/pgindent/indent.bsd.patch."
>&2       EXTRA_OPTS="-bbb -cli1"
fi


I think that you need to use
indent --version -npro </dev/null >/dev/null 2>&1

On my system (Redhat Linux 5.?) I get
  aims2-bernie:$ indent --version  GNU indent 1.9.1  aims2-bernie:$ echo $?  0  aims2-bernie:$ bsdindent --version
bsdindent:Command line: unknown parameter "--version"  aims2-bernie:$ echo $?  1
 

( That is with 'bsdindent' as the patched freebsd indent )


3) 

Finally, the result of running 
 find . -name '*.[ch]' -type f -print | egrep -v '\+\+|/odbc/|s_lock.h'
| xargs -n100 pgindent

on a fresh copy of the 6.5 sources with either the openbsd or patched
bsd indent is the following

Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
./backend/parser/gram.c
Error@5251: #if stack overflow
Error@5252: #if stack overflow
Error@5263: Unmatched #endif
Error@5264: Unmatched #endif
Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
Hope you installed /src/tools/pgindent/indent.bsd.patch.
./interfaces/ecpg/test/header_test.h
Error@19: Stuff missing from end of file.

Are the errors normal or do I still not have a correctly working
version?

Bernie Frankpitt


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

Предыдущее
От: Lamar Owen
Дата:
Сообщение: RPM restrictions (was:Re: [HACKERS] PG_UPGRADE status?)
Следующее
От: Michael Simms
Дата:
Сообщение: Re: [HACKERS] Vacuum analyze bug CAUGHT