summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-01-09 16:42:19 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-01-09 16:42:19 -0500
commit079a9c8229692c8c68899a9ab06693f830c1a091 (patch)
treebd5a431d75c56e736e0e7c638ecbfb22d115ad94
parent46029d273782b441895b23bf5720ebe23d42351f (diff)
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>
-rw-r--r--src/accelerometer/accelerometer.c1
-rw-r--r--src/ata_id/ata_id.c1
-rw-r--r--src/cdrom_id/cdrom_id.c1
-rw-r--r--src/libudev/libudev.c1
-rw-r--r--src/scsi_id/scsi_id.c1
-rw-r--r--src/udev/udev-builtin-kmod.c1
-rw-r--r--src/udev/udev-builtin-path_id.c1
-rw-r--r--test/test-libudev.c1
8 files changed, 8 insertions, 0 deletions
diff --git a/src/accelerometer/accelerometer.c b/src/accelerometer/accelerometer.c
index e611b48a42..86966fbd5f 100644
--- a/src/accelerometer/accelerometer.c
+++ b/src/accelerometer/accelerometer.c
@@ -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)
diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c
index 68a06b93b8..c2bf940cd9 100644
--- a/src/ata_id/ata_id.c
+++ b/src/ata_id/ata_id.c
@@ -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)
diff --git a/src/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c
index b659cc31ee..d0588eb1bd 100644
--- a/src/cdrom_id/cdrom_id.c
+++ b/src/cdrom_id/cdrom_id.c
@@ -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)
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index b8998310d0..c7f9dc4639 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -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)
diff --git a/src/scsi_id/scsi_id.c b/src/scsi_id/scsi_id.c
index 230fa2b782..58a54d4a63 100644
--- a/src/scsi_id/scsi_id.c
+++ b/src/scsi_id/scsi_id.c
@@ -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)
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index 6fdd8aac4e..efd3e3e3cb 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -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)
{
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index da0273197b..f85b091763 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -32,6 +32,7 @@
#include "udev.h"
+_printf_(2,3)
static int path_prepend(char **path, const char *fmt, ...)
{
va_list va;
diff --git a/test/test-libudev.c b/test/test-libudev.c
index 716767ba5f..b2c45360bf 100644
--- a/test/test-libudev.c
+++ b/test/test-libudev.c
@@ -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)