summaryrefslogtreecommitdiffstats
path: root/mpcommon.h
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-03-16 18:57:23 +0100
committerwm4 <wm4@mplayer2.org>2012-03-16 19:14:44 +0100
commit6de8120822c2dd9c50ef23b4977421651396f1ae (patch)
tree11a977608cfc9f50cffbce4a879dd8e9b33b029c /mpcommon.h
parent0eb21226cbfdd200f2aea5d3a9db2cdbff4773a5 (diff)
parenta8168102668337f3c11619bea7e744fc245adff1 (diff)
downloadmpv-6de8120822c2dd9c50ef23b4977421651396f1ae.tar.bz2
mpv-6de8120822c2dd9c50ef23b4977421651396f1ae.tar.xz
Merge remote-tracking branch 'origin/master' into my_master
Conflicts: command.c mp_core.h mplayer.c screenshot.c
Diffstat (limited to 'mpcommon.h')
-rw-r--r--mpcommon.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/mpcommon.h b/mpcommon.h
index fd520eacf6..2ff66fed40 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -31,6 +31,26 @@
#define MP_RESIZE_ARRAY(ctx, p, count) do { \
p = talloc_realloc_size((ctx), p, (count) * sizeof(p[0])); } while (0)
+#ifdef __GNUC__
+
+/** Use gcc attribute to check printf fns. a1 is the 1-based index of
+ * the parameter containing the format, and a2 the index of the first
+ * argument. **/
+#ifdef __MINGW32__
+// MinGW maps "printf" to the non-standard MSVCRT functions, even if
+// __USE_MINGW_ANSI_STDIO is defined and set to 1. We need to use "gnu_printf",
+// which isn't necessarily available on other GCC compatible compilers.
+#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2)))
+#else
+#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (printf, a1, a2)))
+#endif
+
+#else
+
+#define PRINTF_ATTRIBUTE(a1, a2)
+
+#endif
+
extern const char *mplayer_version;
#endif /* MPLAYER_MPCOMMON_H */