[vlc-devel] commit: Support for mingw32 gcc 4.4.0 (Jean-Baptiste Kempf )

git version control git at videolan.org
Sat Jan 9 16:06:34 CET 2010


vlc-1.0-bugfix | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Dec 28 01:02:14 2009 +0100| [96e676d19031839a47032747f296e7c5c98c9ca2] | committer: Jean-Baptiste Kempf 

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 <jb at videolan.org>
Cherry-picked manually from bdfe782fe0a349b45e155140662eecadc9e8eaa3

> http://git.videolan.org/gitweb.cgi/vlc-1.0-bugfix.git/?a=commit;h=96e676d19031839a47032747f296e7c5c98c9ca2
---

 include/vlc_common.h |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 869bfc4..2f1a6db 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -56,9 +56,29 @@
 # include <stdbool.h>
 #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_USED __attribute__ ((warn_unused_result))
 #else
 #   define LIBVLC_FORMAT(x,y)




More information about the vlc-devel mailing list