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 <eric@anholt.net> Signed-off-by: Thierry Reding <treding@nvidia.com>main
parent
7974b539d2
commit
44b08c0ddf
|
@ -29,6 +29,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xf86drm.h"
|
||||
#include "intel_chipset.h"
|
||||
#include "intel_bufmgr.h"
|
||||
|
||||
|
@ -104,11 +105,7 @@ static float int_as_float(uint32_t intval)
|
|||
return uval.f;
|
||||
}
|
||||
|
||||
static void
|
||||
instr_out(struct drm_intel_decode *ctx, unsigned int index,
|
||||
const char *fmt, ...) __attribute__((format(__printf__, 3, 4)));
|
||||
|
||||
static void
|
||||
static void DRM_PRINTFLIKE(3, 4)
|
||||
instr_out(struct drm_intel_decode *ctx, unsigned int index,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
|
|
|
@ -425,7 +425,7 @@ int main(int argc, char **argv)
|
|||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
void DRM_PRINTFLIKE(4, 0)
|
||||
xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
|
||||
va_list args)
|
||||
{
|
||||
|
|
10
xf86drm.c
10
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;
|
||||
}
|
||||
|
|
|
@ -704,7 +704,7 @@ extern int drmSLLookupNeighbors(void *l, unsigned long key,
|
|||
|
||||
extern int drmOpenOnce(void *unused, const char *BusID, int *newlyopened);
|
||||
extern void drmCloseOnce(int fd);
|
||||
extern void drmMsg(const char *format, ...);
|
||||
extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
|
||||
|
||||
extern int drmSetMaster(int fd);
|
||||
extern int drmDropMaster(int fd);
|
||||
|
|
Loading…
Reference in New Issue