From: Simon McVittie Date: Tue, 21 Feb 2012 14:52:49 +0000 (+0000) Subject: Turn the non-valgrind code path into inline functions to avoid compiler warnings X-Git-Tag: dbus-1.5.10~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13c1292150c4f5d57527d11f5b92f5b955f9906e;p=thirdparty%2Fdbus.git Turn the non-valgrind code path into inline functions to avoid compiler warnings Recent gcc will warn if you have a statement that's just a macro expanding to (0), but not if you have an inline stub function that always returns 0, so let's do the latter. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37286 Signed-off-by: Simon McVittie Reviewed-by: Guillaume Desmottes --- diff --git a/dbus/dbus-valgrind-internal.h b/dbus/dbus-valgrind-internal.h index 4c972c598..55566ec01 100644 --- a/dbus/dbus-valgrind-internal.h +++ b/dbus/dbus-valgrind-internal.h @@ -36,10 +36,30 @@ # define VALGRIND_DESTROY_MEMPOOL(_1) /* nothing */ # define VALGRIND_MEMPOOL_ALLOC(_1, _2, _3) /* nothing */ # define VALGRIND_MEMPOOL_FREE(_1, _2) /* nothing */ -# define VALGRIND_MAKE_MEM_UNDEFINED(_1, _2) (0) -# define VALGRIND_PRINTF(...) (0) -# define VALGRIND_PRINTF_BACKTRACE(...) (0) +/* Recent gcc will warn if you have a statement that's just a macro + * expanding to (0), but not if you have an inline stub function that + * always returns 0, so let's do the latter. */ +static inline int +VALGRIND_MAKE_MEM_UNDEFINED (void *addr, + size_t len) +{ + return 0; +} + +static inline int +VALGRIND_PRINTF (const char *format, + ...) +{ + return 0; +} + +static inline int +VALGRIND_PRINTF_BACKTRACE (const char *format, + ...) +{ + return 0; +} # define RUNNING_ON_VALGRIND 0 #endif /* WITH_VALGRIND */