Re: -Wformat-zero-length

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -Wformat-zero-length
Date: 2011-07-07 21:45:27
Message-ID: 3976.1310075127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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]

> So the options I can see are either adding the compiler option
> -Wno-format-zero-length (with configure check and all), or hack up the
> code to do something like this instead: Before:

> prep_status("");

> After:

> prep_status("%s", "");

> Comments?

Shouldn't it be prep_status("\n")? If not, why not? (Right offhand, it
looks to me like prep_status could stand to be redefined in a less
bizarre fashion anyhow.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-07-07 22:09:54 Re: -Wformat-zero-length
Previous Message Kevin Grittner 2011-07-07 21:40:13 Re: SSI atomic commit