Andrew Dunstan <andrew@dunslane.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
C90and C99 features, as well as features from the Single Unix Specification and some BSD and GNU extensions.
Otherlibrary implementations may not support all these features; GCC does not support warning about features that
gobeyond 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