summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-20 18:44:51 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-20 18:47:33 +0100
commit8fca4e305f7f10cd739af8851ec341eab654bad0 (patch)
treee8a68e215a182b3031cb9b95d431835d4d29cf7e /src/test
parentf0f2e63bb2d5cd27e6a2464ee46a670a3159c5da (diff)
macro: add nice macro for disabling -Wnonnull temporarily
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-unit-file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index a8d5b65e6d..63a8a7d076 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -295,9 +295,6 @@ static void test_load_env_file_4(void) {
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wnonnull"
-
static void test_install_printf(void) {
char name[] = "name.service",
path[] = "/run/systemd/system/name.service",
@@ -343,7 +340,11 @@ static void test_install_printf(void) {
expect(i, "%p", "name");
expect(i, "%i", "");
expect(i, "%u", "xxxx-no-such-user");
+
+ DISABLE_WARNING_NONNULL;
expect(i, "%U", NULL);
+ REENABLE_WARNING;
+
expect(i, "%m", mid);
expect(i, "%b", bid);
expect(i, "%H", host);
@@ -355,7 +356,11 @@ static void test_install_printf(void) {
expect(i3, "%N", "name@inst");
expect(i3, "%p", "name");
expect(i3, "%u", "xxxx-no-such-user");
+
+ DISABLE_WARNING_NONNULL;
expect(i3, "%U", NULL);
+ REENABLE_WARNING;
+
expect(i3, "%m", mid);
expect(i3, "%b", bid);
expect(i3, "%H", host);
@@ -363,7 +368,6 @@ static void test_install_printf(void) {
expect(i4, "%u", "root");
expect(i4, "%U", "0");
}
-#pragma GCC diagnostic pop
int main(int argc, char *argv[]) {
int r;