Re: unknown conversion %m

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: unknown conversion %m
Date: 2011-04-27 15:02:05
Message-ID: 15924.1303916525@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> What I'd like to know is why it doesn't complain elsewhere.

That question is backwards ...

> The one
> non-Linux non-Windows machine I have is FBSD. Its gcc (4.2.1) doesn't
> expand "%m" but doesn't complain about it either.

It's libc, not gcc, that's actually got the responsibility of processing
format specifiers at runtime. gcc just assumes a particular behavior of
libc. I quote from the gcc 4.4.5 manual, under -Wformat:

The formats are checked against the format features supported by
GNU libc version 2.2. These include all ISO C90 and C99 features,
as well as features from the Single Unix Specification and some
BSD and GNU extensions. Other library implementations may not
support all these features; GCC does not support warning about
features that go beyond a particular library's limitations.

So the question to ask is not why gcc doesn't complain about %m
elsewhere, but why it does complain in your Windows installation.
I'm guessing that the mingw people hacked it. If you're lucky,
they might have hacked in an extra switch to control the behavior ---
I notice quite a few subsidiary switches that tweak -Wformat behavior
in standard gcc 4.4.5.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-04-27 15:23:14 Re: alpha5
Previous Message Kevin Grittner 2011-04-27 14:59:04 Re: unknown conversion %m