From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: unknown conversion %m |
Date: | 2011-04-27 14:53:42 |
Message-ID: | 4DB82DF6.7060104@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 04/27/2011 10:29 AM, Tom Lane wrote:
> Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
>> On 04/27/2011 12:50 AM, Tom Lane wrote:
>>> Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
>>>> All or almost all the warnings seen on Windows/Mingw of the type
>>>> "warning: unknown conversion type character 'm' in format" come from
>>>> checking of three functions: errmsg, elog and errdetail. I therefore
>>>> propose to disable the attribute checking of those three functions, on
>>>> Windows only (since that's the only place I've seen the warnings).
>>> That seems to me to be throwing the baby out with the bathwater.
>>> If Windows could be assumed to be just like every other platform,
>>> we could maybe figure that being format-warning-free elsewhere
>>> was sufficient checking; but that assumption is obviously wrong.
>> We're not doing anything about the warnings, and I'm not sure there's
>> anything we can do other than suppress them or live with them.
>> The compiler is in fact quite correct, it doesn't know anything about
>> "%m", and if we were ever to use %m in a context where we actually
>> expected it to output the contents of strerror(errno) the warning would
>> be lost among a huge pile of these other warnings where its use is
>> harmless because we expand it ourselves. That strikes me as a more
>> potent danger.
> I don't buy that. The risk that gcc will let past a '%m' without
> complaint, in a function that doesn't actually support it, exists on
> most non-Linux platforms (ie pretty much anywhere you use gcc with
> non-GNU libc), and has existed from the beginning. Despite this,
> I cannot recall that we have ever had a bug of that ilk. But we have
> most certainly had bugs with incorrect/unportable matching of other
> format arguments. I think losing the ability to detect the latter
> in Windows-specific code is a terrible price to pay for silencing
> an easily-ignorable class of warnings.
>
>
What I'd like to know is why it doesn't complain elsewhere. 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 does complain
about other unknown formats. I wonder if they have patched gcc to
silence the warnings?
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-04-27 14:59:04 | Re: unknown conversion %m |
Previous Message | Tom Lane | 2011-04-27 14:29:55 | Re: unknown conversion %m |