[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Remove warning 'format not a string literal' in libsvn_client

From: Gavin Baumanis <gavinb_at_thespidernet.com>
Date: Wed, 11 Nov 2009 10:11:45 +1100

Hi Daniel,

Just checking to see if you're doing any more work with this patch
submission?

Gavin.

On 06/11/2009, at 05:57 , Daniel Näslund wrote:

> On Thu, Nov 05, 2009 at 07:18:29PM +0100, Branko Cibej wrote:
>> Peter Samuelson wrote:
>>> [Daniel Näslund]
>>>
>>>> if (! original_value)
>>>> - header_fmt = _("Added: %s%s");
>>>> + SVN_ERR(file_printf_from_utf8(file, encoding, "Added: %s
>>>> %s",
>>>> + propchange->name,
>>>> APR_EOL_STR));
>>>>
>>>
>>> Julian talked about this code already, but just to point out: your
>>> change is incorrect, because it removes the _() functionality, i.e.,
>>> string localisation. You have to be careful about these things.
>>>
>>> ...Indeed, we use quite a lot of _() with printf format strings (see
>>> all the references to 'c-format' in tools/po/po-update.sh). Why
>>> aren't these _all_ warnings with your compiler?
>>>
>>
>> Because his compiler is probably gcc, and gcc "sees" through gettext
>> ()
>> and friends; in other words, libintl.h declares the necessary
>> function
>> attributes that allow gcc to make assumptions about the return values
>> based on function arguments.
>
> In my libintl.h gettext is declared like this:
>
> extern char *gettext (__const char *__msgid)
> __THROW __attribute_format_arg__ (1);
>
> Where __attribute_format_arg__ specifies that the function takes a
> format string and modifies it but preservers the rest of the %s
> parameters. [1]
>
> But I still haven't found out how _("...") is expanded to
> gettext("...").
>
> Thanks Branko for the information. This day wasn't wasted. I've
> learned
> something new.
>
> /Daniel
>
> [1] http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414876

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2416310
Received on 2009-11-11 00:11:59 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.