Re: -Wformat-zero-length

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: -Wformat-zero-length
Дата
Msg-id 4813.1310076594@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: -Wformat-zero-length  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: -Wformat-zero-length
Re: -Wformat-zero-length
Список pgsql-hackers
I wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> I was adding gcc printf attributes to more functions in obscure places,
>> and now I'm seeing this in pg_upgrade:

>> relfilenode.c:72:2: warning: zero-length gnu_printf format string [-Wformat-zero-length]

> Shouldn't it be prep_status("\n")?  If not, why not?

On closer inspection, it appears to me that prep_status should never be
called with a string containing a newline, period, and the test it
contains for that case is just brain damage.  The only reason to call it
at all is to produce a line like
message ......................

where something more is expected to be added to the line later.  Calls
that are meant to produce a complete line could go directly to pg_log.

This in turn implies that transfer_all_new_dbs's use of the function is
broken and needs to be rethought.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: -Wformat-zero-length
Следующее
От: Noah Misch
Дата:
Сообщение: Re: [v9.2] Fix leaky-view problem, part 2