diff options
author | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2013-12-14 13:09:07 +0100 |
---|---|---|
committer | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2013-12-14 13:32:22 +0100 |
commit | 9091e686f43184065381aa71929e3df36a4ea2e1 (patch) | |
tree | 37fe0c888a655bcf2d976411f21c068c300abbae /src/journal | |
parent | 8d35dae708ffbb88f1b023964913d3d53d4a7418 (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.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-gatewayd.c | 1 | ||||
-rw-r--r-- | src/journal/microhttpd-util.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c index 384137b2bd..5c35d8e77e 100644 --- a/src/journal/journal-gatewayd.c +++ b/src/journal/journal-gatewayd.c @@ -131,6 +131,7 @@ static int respond_oom_internal(struct MHD_Connection *connection) { #define respond_oom(connection) log_oom(), respond_oom_internal(connection) +_printf_(3,4) static int respond_error( struct MHD_Connection *connection, unsigned code, diff --git a/src/journal/microhttpd-util.c b/src/journal/microhttpd-util.c index 382087c790..5675af4a19 100644 --- a/src/journal/microhttpd-util.c +++ b/src/journal/microhttpd-util.c @@ -27,6 +27,9 @@ #include "macro.h" #include "util.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +_printf_(2,0) void microhttpd_logger(void *arg, const char *fmt, va_list ap) { _cleanup_free_ char *f; if (asprintf(&f, "microhttpd: %s", fmt) <= 0) { @@ -35,3 +38,4 @@ void microhttpd_logger(void *arg, const char *fmt, va_list ap) { } log_metav(LOG_INFO, NULL, 0, NULL, f, ap); } +#pragma GCC diagnostic pop |