From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: -Wformat-zero-length |
Date: | 2011-08-27 13:01:52 |
Message-ID: | 1314450112.2349.27.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On tor, 2011-07-07 at 18:09 -0400, Tom Lane wrote:
> I wrote:
> > Peter Eisentraut <peter_e(at)gmx(dot)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.
I think this got a bit besides the point. There is probably some
bogosity in the logging implementation, but I think the prep_status("")
call is correct and purposeful at that point, namely to clear the line.
The question is, do we consider empty format strings a bug worth warning
about, or should we shut off the warning?
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2011-08-27 13:14:33 | Re: Inputting relative datetimes |
Previous Message | Dean Rasheed | 2011-08-27 11:43:57 | Re: Inputting relative datetimes |