summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-12-14 13:09:07 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-12-14 13:32:22 +0100
commit9091e686f43184065381aa71929e3df36a4ea2e1 (patch)
tree37fe0c888a655bcf2d976411f21c068c300abbae /src/core
parent8d35dae708ffbb88f1b023964913d3d53d4a7418 (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/core')
-rw-r--r--src/core/job.c3
-rw-r--r--src/core/unit.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/core/job.c b/src/core/job.c
index ce97263f03..491c73d47b 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -610,6 +610,8 @@ _pure_ static const char *job_get_status_message_format_try_harder(Unit *u, JobT
return NULL;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void job_print_status_message(Unit *u, JobType t, JobResult result) {
const char *format;
@@ -676,6 +678,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
unit_status_printf(u, ANSI_HIGHLIGHT_ON " INFO " ANSI_HIGHLIGHT_OFF, "%s is not active.");
}
}
+#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
diff --git a/src/core/unit.c b/src/core/unit.c
index 6458c7f570..160a346d86 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1125,6 +1125,8 @@ _pure_ static const char *unit_get_status_message_format_try_harder(Unit *u, Job
return NULL;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
const char *format;
@@ -1139,6 +1141,7 @@ static void unit_status_print_starting_stopping(Unit *u, JobType t) {
unit_status_printf(u, "", format);
}
+#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"