add printf checking

This commit is contained in:
Wim Taymans 2016-10-05 18:34:36 +02:00
parent 49dae17dfb
commit 6e6b5588f4
2 changed files with 8 additions and 2 deletions

View file

@ -107,6 +107,12 @@ typedef void (*SpaNotify) (void *data);
#define SPA_TIMESPEC_TO_TIME(ts) ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec) #define SPA_TIMESPEC_TO_TIME(ts) ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec)
#define SPA_TIMEVAL_TO_TIME(tv) ((tv)->tv_sec * SPA_NSEC_PER_SEC + (tv)->tv_usec * 1000ll) #define SPA_TIMEVAL_TO_TIME(tv) ((tv)->tv_sec * SPA_NSEC_PER_SEC + (tv)->tv_usec * 1000ll)
#ifdef __GNUC__
# define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
#else
# define SPA_PRINTF_FUNC(fmt, arg1)
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View file

@ -87,7 +87,7 @@ struct _SpaLog {
const char *file, const char *file,
int line, int line,
const char *func, const char *func,
const char *fmt, ...); const char *fmt, ...) SPA_PRINTF_FUNC(6, 7);
/** /**
* SpaLog::logv * SpaLog::logv
@ -107,7 +107,7 @@ struct _SpaLog {
int line, int line,
const char *func, const char *func,
const char *fmt, const char *fmt,
va_list args); va_list args) SPA_PRINTF_FUNC(6, 0);
}; };
#if __STDC_VERSION__ >= 199901L #if __STDC_VERSION__ >= 199901L