[vlc-devel] Win64 patch and format

Rafaël Carré rafael.carre at gmail.com
Wed Sep 2 17:58:24 CEST 2009


On Wed, 2 Sep 2009 18:32:40 +0300
"Rémi Denis-Courmont" <remi at remlab.net> wrote:

> Le mercredi 2 septembre 2009 18:22:18 Rafaël Carré, vous avez écrit :
> > On Wed, 2 Sep 2009 18:08:45 +0300
> >
> > "Rémi Denis-Courmont" <remi at remlab.net> wrote:
> > > >  /* Format string sanity checks */
> > > >  #ifdef __GNUC__
> > > > +# ifdef _WIN64
> > > > +#   define LIBVLC_FORMAT(x,y) __attribute__
> > > > ((format(gnu_printf,x,y))) +# else
> > >
> > > Wouldn't that apply to any Mingw variant, not just Win64?
> >
> > It would apply to Linux, *BSD, OSX, etc .. because we use the glibc
> > specific format at least in __msg_Generic() with "%m"
> 
> Do their gcc only support gnu_printf?? It's not in the official
> documentation.

Good question, I didn't find this in my 'info gcc' but on:

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes

On MinGW targets, ms_printf, ms_scanf, and ms_strftime are also
present. archtype values such as printf refer to the formats accepted
by the system's C run-time library, while gnu_ values always refer to
the formats accepted by the GNU C Library.

It doesn't specify in which version it was introduced but we could check

I tested on OSX (gcc 4.0.1) and I got
test.c:8: warning: 'gnu_printf' is an unrecognized format function type

% cat test.c 
#include <stddef.h> /* NULL */

void b(char*, ...) __attribute__((format(printf,1,2)));
void b(char* s, ...)
{
}

void a(char*, ...) __attribute__((format(gnu_printf,1,2)));
void a(char* s, ...)
{
}

int main(void)
{
    a(NULL, "%s %m %d\n","lol", 1);
    b(NULL, "%s %d\n","lol",1);

    return 0;
}


-- 
Rafaël Carré
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090902/dd3e6c2b/attachment.sig>


More information about the vlc-devel mailing list