Re: Fixes for compiler warnings - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Fixes for compiler warnings
Date
Msg-id 49737D2C.2000902@hagander.net
Whole thread Raw
In response to Re: Fixes for compiler warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> alanwli@gmail.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



pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Fixes for compiler warnings
Next
From: Magnus Hagander
Date:
Subject: Re: libpq WSACleanup is not needed