diff options
Diffstat (limited to 'mpcommon.h')
-rw-r--r-- | mpcommon.h | 20 |
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 */ |