log/llog: add gcc format checks
Add gcc attributes so the printf formats are correctly checked. This causes a lot of warnings which will be fixed in the following commits. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
26fae42b0c
commit
e0d30b2283
@ -176,6 +176,7 @@ void log_clean_filter();
|
||||
* some log-message at application start. This is a handy-helper to do this.
|
||||
*/
|
||||
|
||||
__attribute__((format(printf, 7, 0)))
|
||||
void log_submit(const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
@ -185,6 +186,7 @@ void log_submit(const char *file,
|
||||
const char *format,
|
||||
va_list args);
|
||||
|
||||
__attribute__((format(printf, 7, 8)))
|
||||
void log_format(const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
@ -194,6 +196,7 @@ void log_format(const char *file,
|
||||
const char *format,
|
||||
...);
|
||||
|
||||
__attribute__((format(printf, 6, 0)))
|
||||
void log_llog(const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
@ -205,7 +208,8 @@ void log_llog(const char *file,
|
||||
int log_set_file(const char *file);
|
||||
void log_print_init(const char *appname);
|
||||
|
||||
static inline void log_dummyf(unsigned int sev, const char *format, ...)
|
||||
static inline __attribute__((format(printf, 2, 3)))
|
||||
void log_dummyf(unsigned int sev, const char *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,15 +71,15 @@ typedef void (*llog_submit_t) (const char *file,
|
||||
const char *format,
|
||||
va_list args);
|
||||
|
||||
__attribute__((__unused__))
|
||||
static void llog_format(llog_submit_t llog,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *subs,
|
||||
unsigned int sev,
|
||||
const char *format,
|
||||
...)
|
||||
static inline __attribute__((format(printf, 7, 8)))
|
||||
void llog_format(llog_submit_t llog,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *subs,
|
||||
unsigned int sev,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
@ -101,8 +101,9 @@ static const char *LLOG_SUBSYSTEM __attribute__((__unused__));
|
||||
#define llog_dprintf(obj, sev, format, ...) \
|
||||
llog_format((obj), LLOG_DEFAULT, (sev), (format), ##__VA_ARGS__)
|
||||
|
||||
static inline void llog_dummyf(llog_submit_t llog, unsigned int sev,
|
||||
const char *format, ...)
|
||||
static inline __attribute__((format(printf, 3, 4)))
|
||||
void llog_dummyf(llog_submit_t llog, unsigned int sev,
|
||||
const char *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user