From: Jean-Baptiste Kempf Date: Mon, 28 Dec 2009 00:02:14 +0000 (+0100) Subject: Support for mingw32 gcc 4.4.0 X-Git-Tag: 1.1.0-ff~1615 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=bdfe782fe0a349b45e155140662eecadc9e8eaa3;p=vlc Support for mingw32 gcc 4.4.0 This is meant to fix the *printf format strings. This is compatible with mingw 4.2.1 and 4.3.0 I haven't find a better place where to put this code... Signed-off-by: Jean-Baptiste Kempf --- diff --git a/include/vlc_common.h b/include/vlc_common.h index d8dd5807a0..d817166d61 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -56,9 +56,29 @@ # include #endif +/* Try to fix format strings for all versions of mingw and mingw64 */ +#if defined( _WIN32 ) && defined( __USE_MINGW_ANSI_STDIO ) + #undef PRId64 + #define PRId64 "lld" + #undef PRIi64 + #define PRIi64 "lli" + #undef PRIu64 + #define PRIu64 "llu" + #undef PRIo64 + #define PRIo64 "llo" + #undef PRIx64 + #define PRIx64 "llx" + #define snprintf __mingw_snprintf + #define vsnprintf __mingw_vsnprintf +#endif + /* Format string sanity checks */ #ifdef __GNUC__ -# define LIBVLC_FORMAT(x,y) __attribute__ ((format(printf,x,y))) +# if defined( _WIN32 ) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 +# define LIBVLC_FORMAT(x,y) __attribute__ ((format(gnu_printf,x,y))) +# else +# define LIBVLC_FORMAT(x,y) __attribute__ ((format(printf,x,y))) +# endif # define LIBVLC_FORMAT_ARG(x) __attribute__ ((format_arg(x))) # define LIBVLC_USED __attribute__ ((warn_unused_result)) # define LIBVLC_MALLOC __attribute__ ((malloc))