From 9caae9b385a6de3f4dae98bebb1be64a997c1472 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 29 Jun 2011 09:51:49 +0300 Subject: mp_msg: change mp_dbg() to inline function to check syntax Change mp_dbg() from a macro that is defined to empty when MP_DEBUG is unset to an inline function that has an empty body when MP_DEBUG is unset. This allows the syntax of the calls to be checked even when compiling without MP_DEBUG set. --- mp_msg.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mp_msg.h') diff --git a/mp_msg.h b/mp_msg.h index 7273b2a82d..7e2b4f29b5 100644 --- a/mp_msg.h +++ b/mp_msg.h @@ -140,16 +140,21 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va); #ifdef __GNUC__ void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); void mp_tmsg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); +static inline void mp_dbg(int mod, int lev, const char *format, ...) __attribute__ ((format (printf, 3, 4))); #else // not GNU C void mp_msg(int mod, int lev, const char *format, ... ); void mp_tmsg(int mod, int lev, const char *format, ...) #endif /* __GNUC__ */ +static inline void mp_dbg(int mod, int lev, const char *format, ...) +{ #ifdef MP_DEBUG -#define mp_dbg(mod,lev, ... ) mp_msg(mod, lev, __VA_ARGS__) -#else -#define mp_dbg(mod,lev, ... ) /* only useful for developers */ + va_list va; + va_start(va, format); + mp_msg_va(mod, lev, format, va); + va_end(va); #endif +} const char* filename_recode(const char* filename); -- cgit v1.2.3