a41c76
From 401d5f108c69a01fca8843868e12d102e75e8dd2 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <401d5f108c69a01fca8843868e12d102e75e8dd2@dist-git>
a41c76
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
a41c76
Date: Fri, 13 Mar 2020 13:08:06 +0100
a41c76
Subject: [PATCH] virbuftest: use field names when initalizing test info
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Allow adding new fields without changing all the macros.
a41c76
a41c76
Otherwise the compiler complains that not all have been initialized:
a41c76
../../tests/virbuftest.c:419:5: error: missing field 'arg' initializer [-Werror,-Wmissing-field-initializers]
a41c76
    DO_TEST_ESCAPE("",
a41c76
    ^
a41c76
../../tests/virbuftest.c:414:56: note: expanded from macro 'DO_TEST_ESCAPE'
a41c76
        struct testBufAddStrData info = { data, expect }; \
a41c76
a41c76
Signed-off-by: Ján Tomko <jtomko@redhat.com>
a41c76
Reviewed-by: Erik Skultety <eskultet@redhat.com>
a41c76
(cherry picked from commit 46afdc21207d3276f0e100b6e54ca41ee5f12e99)
a41c76
a41c76
Prerequisite for: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
a41c76
a41c76
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
Message-Id: <b5da3d53ae4fc1a592b41230f3b838357cc57d30.1584101247.git.mprivozn@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 tests/virbuftest.c | 12 ++++++------
a41c76
 1 file changed, 6 insertions(+), 6 deletions(-)
a41c76
a41c76
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
a41c76
index bb606c1c28..1780b62bf4 100644
a41c76
--- a/tests/virbuftest.c
a41c76
+++ b/tests/virbuftest.c
a41c76
@@ -372,9 +372,9 @@ mymain(void)
a41c76
     DO_TEST("set indent", testBufSetIndent);
a41c76
     DO_TEST("autoclean", testBufferAutoclean);
a41c76
 
a41c76
-#define DO_TEST_ADD_STR(DATA, EXPECT) \
a41c76
+#define DO_TEST_ADD_STR(_data, _expect) \
a41c76
     do { \
a41c76
-        struct testBufAddStrData info = { DATA, EXPECT }; \
a41c76
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
a41c76
         if (virTestRun("Buf: AddStr", testBufAddStr, &info) < 0) \
a41c76
             ret = -1; \
a41c76
     } while (0)
a41c76
@@ -384,9 +384,9 @@ mymain(void)
a41c76
     DO_TEST_ADD_STR("\n", "<c>\n  \n</c>");
a41c76
     DO_TEST_ADD_STR("\n  \n\n", "<c>\n  \n    \n  \n</c>");
a41c76
 
a41c76
-#define DO_TEST_ESCAPE(data, expect) \
a41c76
+#define DO_TEST_ESCAPE(_data, _expect) \
a41c76
     do { \
a41c76
-        struct testBufAddStrData info = { data, expect }; \
a41c76
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
a41c76
         if (virTestRun("Buf: EscapeStr", testBufEscapeStr, &info) < 0) \
a41c76
             ret = -1; \
a41c76
     } while (0)
a41c76
@@ -400,9 +400,9 @@ mymain(void)
a41c76
     DO_TEST_ESCAPE("\x01\x01\x02\x03\x05\x08",
a41c76
                    "<c>\n  <el></el>\n</c>");
a41c76
 
a41c76
-#define DO_TEST_ESCAPE_REGEX(data, expect) \
a41c76
+#define DO_TEST_ESCAPE_REGEX(_data, _expect) \
a41c76
     do { \
a41c76
-        struct testBufAddStrData info = { data, expect }; \
a41c76
+        struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
a41c76
         if (virTestRun("Buf: EscapeRegex", testBufEscapeRegex, &info) < 0) \
a41c76
             ret = -1; \
a41c76
     } while (0)
a41c76
-- 
a41c76
2.25.1
a41c76