Re: Fixes for compiler warnings

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: alanwli(at)gmail(dot)com, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixes for compiler warnings
Date: 2009-01-18 19:04:12
Message-ID: 49737D2C.2000902@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> alanwli(at)gmail(dot)com writes:
>>> One thing to watch out for is that the intention may have been to allow
>>> the strings to be translated.
>
>> I'm not sure if that's the case. How does one find out?
>
> If the origin of the "variable" format is a constant or set of constants
> decorated with gettext_noop(), then this type of edit will have defeated
> the intended localization. In the cases at hand, I believe that all but
> one of your proposed patches break the desired behavior.
>
> What's worse, I see that Magnus got there before you, and has broken
> localization here and in several other places:
> http://archives.postgresql.org/pgsql-committers/2008-11/msg00264.php

> Magnus, you wanna clean up the mess?

Crap. Yeah, I'll try to get around to that soon. No time tonight though.

> And what patch does the "few more"
> comment refer back to?

I think it refers to this:
http://archives.postgresql.org/pgsql-committers/2008-11/msg00249.php

Initially it came out of this thread:
http://archives.postgresql.org/pgsql-hackers/2008-11/msg01348.php

If my memory is correct, there shouldn't be more than those two patches.

> A workable solution that both silences the warning and preserves
> localizability is to follow a coding pattern like this:
>
> const char *mymsg = gettext_noop("Some text to be localized.");
>
> ...
>
> errmsg("%s", _(mymsg)) // not just errmsg(mymsg)
>
> I would recommend that we do this, because otherwise we are certainly
> going to have more breakage from well-intentioned patchers, whatever
> Peter's opinion of the merits of the compiler warning might be ;-)

Seems reasonable.

//Magnus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2009-01-18 19:10:57 Re: libpq WSACleanup is not needed
Previous Message Gregory Stark 2009-01-18 18:30:12 Re: Fixes for compiler warnings