Peter Eisentraut <peter_e@gmx.net> writes:
> On Tuesday 26 May 2009 21:05:29 Tom Lane wrote:
>> I experimented with this and found that indeed both format strings are
>> checked ... if you have a reasonably recent libintl.h AND you have
>> specified --enable-nls. Otherwise it all goes to heck, apparently
>> because the compiler doesn't try to look through our substitute
>> definition
>>
>> #define ngettext(s,p,n) ((n) == 1 ? (s) : (p))
> I can't reproduce that. Do you have a concrete example? Different compiler
> versions, perhaps?
After further experimentation I think I must have gotten confused
yesterday. gcc 4.3.2 does seem to understand that it should check both
format strings in the ?: construct. What was not making that check is
the relic 2.95.3 version that I use for trailing-edge compatibility
checking. However, 2.95.3 appears to handle only one format_arg()
attribute per function, and so the proposed alternative coding doesn't
help it very much either. Unless there's some intermediate version
that can do two format_arg()s but doesn't look through ?:, it's
probably not worth changing.
So on the whole I withdraw that line of complaint. But I'm still
not happy, because I've thought of another one ;-) To wit, the current
coding fails to respect the gettext domain when working with pluralized
messages.
regards, tom lane