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

Re: [PATCH] Tweak NLS for better gcc printf format checking

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-08-19 22:46:07 CEST

On Fri, 19 Aug 2005, Philip Martin wrote:

> "Jonathan Gilbert" <o2w9gs702@sneakemail.com> writes:
>
> > At 06:48 PM 19/08/2005 +0100, Philip Martin wrote:
> >>Well, I haven't done much Subversion coding recently, but working on
> >>r15828 leads me to make the following observations:
> > [snip]
> >>2. I18N
> >>
> >> Using _("foo %s bar") defeats gcc's printf format string checking,
> >> if I insert '#define _(X) X' it starts working. Is there some
> >> magic way to configure/build so that all the formats get checked?
>
> > [snip]
> >
> > One approach would be to add an attribute to the declaration of '_',
> > turning it into function:
> >
> > char *_(const char *msgid) __attribute__((__format_arg__(1),
> > __always_inline__))
> > {
> > return libintl_gettext(msgid);
> > }
> >
> > This tells GCC that when '_' is passed as a format parameter to a
> > printf-like function, the argument to '_' should be used for type-checking
> > the arguments.
>
> Looks promising, this seems to work
>
[snip]

> What do people think?
>
>
What GCC do you use? Format checking work on my GCC 4.0/glibc on Debina
testing. That's because these magic attributes are used internally by
libintl.h.

Regards,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 19 22:52:21 2005

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.