Re: spurious use of %m format in pg_upgrade

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: spurious use of %m format in pg_upgrade
Date: 2011-07-07 20:09:49
Message-ID: 1310069389.31709.10.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On tor, 2011-07-07 at 00:22 -0400, Tom Lane wrote:
> Is there a way to persuade gcc to complain about such extensions when
> used in contexts where we don't know they work?

I don't think so.

First of all, the comment in pg_config_manual.h says that we *want* the
compiler to recognize %m as valid, and we apply the same attribute
globally. And secondly, the difference between the gnu_printf attribute
and the plain printf attribute is that the latter checks for what the
target's C library accepts, which is equivalent to gnu_printf if you're
on glibc, at least. According to the gcc source code, the target is
supposed to override the conversion specifier list accordingly, but it
looks like, for example, FreeBSD doesn't do that, which could be
considered a bug there. The only override in the gcc source code itself
is MinGW, which is where the whole trouble in pg_config_manual.h stems
from in the first place. (Look for TARGET_OVERRIDES_FORMAT_ATTRIBUTES
in the gcc source if you want to investigate.)

There does not, unfortunately, appear to be an attribute that says to
check conversion specifiers according to some standard (even though the
internal structures of gcc appear to support that, but they'd currently
have %m in the wrong category there anyway).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2011-07-07 20:24:07 Re: Creating temp tables inside read only transactions
Previous Message Tom Lane 2011-07-07 20:06:41 Re: Inconsistency between postgresql.conf and docs