Re: pgindent complaint of the day

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pgindent complaint of the day
Дата
Msg-id 200410070226.i972QKq25554@candle.pha.pa.us
обсуждение исходный текст
Ответ на pgindent complaint of the day  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgindent complaint of the day  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> This case in xlog.c is representative of a disease that pgindent has had
> for awhile:
> 
> @@ -4276,7 +4300,8 @@ StartupXLOG(void)
>                 if (needNewTimeLine)    /* stopped because of stop request */
>                         ereport(FATAL,
>                                         (errmsg("requested recovery stop point is before end time of backup
dump")));
> -               else                                    /* ran off end of WAL */
> +               else
> +/* ran off end of WAL */
>                         ereport(FATAL,
>                                         (errmsg("WAL ends before end time of backup dump")));
>         }
> 
> I'm not sure of all the triggering conditions, but every so often it
> decides to move a line-ending comment to its own line (which is a wrong
> policy in the first place IMHO) and forgets to indent it.  I've mostly
> seen it on "else" lines but I'm not sure that's the only case.

You are correct that it only happens on comments on an else line.  The
problem is that there is a BSD indent bug that will stop processing the
file in such cases so we have in pgindent:
# workaround for indent bug with 'else' handling       sed 's;\([}     ]\)else[        ]*\(/\*.*\)$;\1else\\2;g' |

and this does exactly as you describe by putting the comment on its own
line.  I just changed it to:
# workaround for indent bug with 'else' handling       sed 's;\([}     ]\)else\([      ]*\)\(/\*.*\)$;\1else\\2\3;g' |

so that the new comment will have the same indenting as the else that
was input.  It should help but will not be perfect.

--  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,
Pennsylvania19073
 


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

Предыдущее
От: Euler Taveira de Oliveira
Дата:
Сообщение: initdb crash
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: SRF/dropped column bug