Add more _printf_'s for format-nonliterals

Clang is a bit more strict wrt format-nonliterals:
http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking

Adding these extra printf attributes also makes gcc able to find more
problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c

Some parts looked intetional about breaking the format-nonliteral check.
I added some supression for warnings there.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2014-01-09 16:42:19 -05:00 committed by Anthony G. Basile
parent 46029d2737
commit 079a9c8229
8 changed files with 8 additions and 0 deletions

View File

@ -71,6 +71,7 @@
static int debug = 0;
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)

View File

@ -405,6 +405,7 @@ out:
return ret;
}
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)

View File

@ -43,6 +43,7 @@
static bool debug;
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)

View File

@ -65,6 +65,7 @@ void udev_log(struct udev *udev,
va_end(args);
}
_printf_(6,0)
static void log_stderr(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args)

View File

@ -67,6 +67,7 @@ static char model_enc_str[256];
static char revision_str[16];
static char type_str[16];
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)

View File

@ -73,6 +73,7 @@ static int load_module(struct udev *udev, const char *alias)
#endif
}
_printf_(6,0)
static void udev_kmod_log(void *data, int priority, const char *file, int line,
const char *fn, const char *format, va_list args)
{

View File

@ -32,6 +32,7 @@
#include "udev.h"
_printf_(2,3)
static int path_prepend(char **path, const char *fmt, ...)
{
va_list va;

View File

@ -33,6 +33,7 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
_printf_(6,0)
static void log_fn(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args)