44 lines
1.3 KiB
Diff
44 lines
1.3 KiB
Diff
From 6fa1497436693b2a2d8577dcae86a2bebca5b3f3 Mon Sep 17 00:00:00 2001
|
|
From: chengzihan2 <chengzihan1111@163.com>
|
|
Date: Tue, 2 Jun 2020 10:57:02 +0800
|
|
Subject: [PATCH] gcc-9 stricter on NULL arguments for printf
|
|
|
|
---
|
|
lib/libvarnish/vnum.c | 20 +++++++++++---------
|
|
1 file changed, 11 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c
|
|
index 6caf931..2611768 100644
|
|
--- a/lib/libvarnish/vnum.c
|
|
+++ b/lib/libvarnish/vnum.c
|
|
@@ -348,15 +348,17 @@ main(int argc, char *argv[])
|
|
|
|
for (tc = test_cases; tc->str; ++tc) {
|
|
e = VNUM_2bytes(tc->str, &val, tc->rel);
|
|
- if (e != tc->err) {
|
|
- printf("%s: VNUM_2bytes(\"%s\", %ju) (%s) != (%s)\n",
|
|
- *argv, tc->str, tc->rel, tc->err, e);
|
|
- ++ec;
|
|
- } else if (e == NULL && val != tc->val) {
|
|
- printf("%s: VNUM_2bytes(\"%s\", %ju) %ju != %ju (%s)\n",
|
|
- *argv, tc->str, tc->rel, val, tc->val, e);
|
|
- ++ec;
|
|
- }
|
|
+ if (e != NULL)
|
|
+ val = 0;
|
|
+ if (e == tc->err && val == tc->val)
|
|
+ continue;
|
|
+ ++ec;
|
|
+ printf("%s: VNUM_2bytes(\"%s\", %ju)\n",
|
|
+ *argv, tc->str, tc->rel);
|
|
+ printf("\tExpected:\tstatus %s - value %ju\n",
|
|
+ tc->err ? tc->err : "Success", tc->val);
|
|
+ printf("\tGot:\t\tstatus %s - value %ju\n",
|
|
+ e ? e : "Success", val);
|
|
}
|
|
if (!isnan(VNUM_duration(NULL))) {
|
|
printf("%s: VNUM_Duration(NULL) fail\n", *argv);
|
|
--
|
|
2.23.0
|
|
|