Mark the log functions with the printf format attribute

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
Peter Hutterer 2014-05-15 09:54:10 +10:00
parent 25507127bd
commit f5c4de024d
3 changed files with 8 additions and 6 deletions

View file

@ -1537,13 +1537,13 @@ ENABLE_PREPROCESSING = YES
# compilation will be performed. Macro expansion can be done in a controlled # compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES. # way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the # then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags. # PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# pointed to by INCLUDE_PATH will be searched when a #include is found. # pointed to by INCLUDE_PATH will be searched when a #include is found.
@ -1571,7 +1571,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator # undefined via #undef or recursively expanded use the := operator
# instead of the = operator. # instead of the = operator.
PREDEFINED = PREDEFINED = LIBEVDEV_ATTRIBUTE_PRINTF(f,a)=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded. # this tag can be used to specify a list of macro names that should be expanded.

View file

@ -36,7 +36,6 @@
#define ABS_MT_MAX ABS_MT_TOOL_Y #define ABS_MT_MAX ABS_MT_TOOL_Y
#define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1) #define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1)
#define LIBEVDEV_EXPORT __attribute__((visibility("default"))) #define LIBEVDEV_EXPORT __attribute__((visibility("default")))
#define LIBEVDEV_PRINTF(_format, _args) __attribute__ ((format (printf, _format, _args)))
#define ALIAS(_to) __attribute__((alias(#_to))) #define ALIAS(_to) __attribute__((alias(#_to)))
/** /**
@ -131,7 +130,7 @@ extern void
log_msg(enum libevdev_log_priority priority, log_msg(enum libevdev_log_priority priority,
void *data, void *data,
const char *file, int line, const char *func, const char *file, int line, const char *func,
const char *format, ...) LIBEVDEV_PRINTF(6, 7); const char *format, ...) LIBEVDEV_ATTRIBUTE_PRINTF(6, 7);
/** /**
* @return a pointer to the next element in the queue, or NULL if the queue * @return a pointer to the next element in the queue, or NULL if the queue

View file

@ -30,6 +30,8 @@ extern "C" {
#include <linux/input.h> #include <linux/input.h>
#include <stdarg.h> #include <stdarg.h>
#define LIBEVDEV_ATTRIBUTE_PRINTF(_format, _args) __attribute__ ((format (printf, _format, _args)))
/** /**
* @mainpage * @mainpage
* *
@ -790,7 +792,8 @@ typedef void (*libevdev_log_func_t)(enum libevdev_log_priority priority,
void *data, void *data,
const char *file, int line, const char *file, int line,
const char *func, const char *func,
const char *format, va_list args); const char *format, va_list args)
LIBEVDEV_ATTRIBUTE_PRINTF(6, 0);
/** /**
* @ingroup init * @ingroup init