From 44b08c0ddf7ced99a5914421f18b269a1dcaafae Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Wed, 22 Jan 2014 12:06:51 +0100 Subject: Mark functions printf-like where possible These functions all take a format string and either a list of variable arguments or a va_list. Use the new DRM_PRINTFLIKE macro to tell the compiler about it so that the arguments can be checked against the format string. Reviewed-by: Eric Anholt Signed-off-by: Thierry Reding --- xf86drm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'xf86drm.c') diff --git a/xf86drm.c b/xf86drm.c index 720952ff..fa5701ab 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -104,12 +104,16 @@ void drmSetServerInfo(drmServerInfoPtr info) * This function is a wrapper around vfprintf(). */ -static int drmDebugPrint(const char *format, va_list ap) +static int DRM_PRINTFLIKE(1, 0) +drmDebugPrint(const char *format, va_list ap) { return vfprintf(stderr, format, ap); } -static int (*drm_debug_print)(const char *format, va_list ap) = drmDebugPrint; +typedef int DRM_PRINTFLIKE(1, 0) (*debug_msg_func_t)(const char *format, + va_list ap); + +static debug_msg_func_t drm_debug_print = drmDebugPrint; void drmMsg(const char *format, ...) @@ -129,7 +133,7 @@ drmMsg(const char *format, ...) } void -drmSetDebugMsgFunction(int (*debug_msg_ptr)(const char *format, va_list ap)) +drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr) { drm_debug_print = debug_msg_ptr; } -- cgit v1.2.3