summaryrefslogtreecommitdiff
path: root/src/core/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-20 18:18:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-20 18:18:32 +0100
commitbcfce235a3d757f0ec3b0c01e8583382db1adfe2 (patch)
tree78a0c2102a7b0db526c01abeb352e77e708f418e /src/core/job.c
parentbeb999379ced9e8d765e533e43d35aab11aa5c39 (diff)
macro: introduce a nice macro for disabling -Wformat-nonliteral temporarily
Diffstat (limited to 'src/core/job.c')
-rw-r--r--src/core/job.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 2f998f8958..0cd4397bf2 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -610,8 +610,6 @@ _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;
@@ -619,6 +617,8 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
assert(t >= 0);
assert(t < _JOB_TYPE_MAX);
+ DISABLE_WARNING_FORMAT_NONLITERAL;
+
if (t == JOB_START) {
format = job_get_status_message_format(u, t, result);
if (!format)
@@ -681,11 +681,10 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
if (result == JOB_SKIPPED)
unit_status_printf(u, ANSI_HIGHLIGHT_ON " INFO " ANSI_HIGHLIGHT_OFF, "%s is not active.");
}
+
+ REENABLE_WARNING;
}
-#pragma GCC diagnostic pop
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void job_log_status_message(Unit *u, JobType t, JobResult result) {
const char *format;
char buf[LINE_MAX];
@@ -704,8 +703,10 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
if (!format)
return;
+ DISABLE_WARNING_FORMAT_NONLITERAL;
snprintf(buf, sizeof(buf), format, unit_description(u));
char_array_0(buf);
+ REENABLE_WARNING;
if (t == JOB_START) {
sd_id128_t mid;
@@ -734,7 +735,6 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
"MESSAGE=%s", buf,
NULL);
}
-#pragma GCC diagnostic pop
int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
Unit *u;