[Spice-devel] [PATCH spice-gtk] tests: Shut up warnings about unitialized struct fields

Eduardo Lima (Etrunko) etrunko at redhat.com
Tue Apr 24 19:24:32 UTC 2018


Build complains about lots of unitialized fields in TestCase definition,
for instance:

../tests/session.c:276:11: warning: missing initializer for field ‘message’ of ‘TestCase {aka const struct <anonymous>}’ [-Wmissing-field-initializers]
           "spice://[::192.9.5.5]:5910" },
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tests/session.c:11:18: note: ‘message’ declared here
     const gchar *message;
                  ^~~~~~~
../tests/session.c:282:11: warning: missing initializer for field ‘unix_path’ of ‘TestCase {aka const struct <anonymous>}’ [-Wmissing-field-initializers]
           "password may be visible in process listings"},
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
 tests/session.c | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/tests/session.c b/tests/session.c
index f0ecda2..8208016 100644
--- a/tests/session.c
+++ b/tests/session.c
@@ -220,38 +220,44 @@ static void test_session_uri_ipv4_good(void)
           "localhost",
           NULL, NULL,
           "spice://localhost?port=5900&tls-port=",
-          "spice://localhost:5900" },
+          "spice://localhost:5900",
+          NULL, NULL },
         { "5910", NULL,
           "localhost",
           "user", NULL,
           "spice://user@localhost?tls-port=&port=5910",
-          "spice://localhost:5910" },
+          "spice://localhost:5910",
+          NULL, NULL },
         { NULL, "5920",
           "localhost",
           "user", "password",
           "spice://user@localhost?tls-port=5920&port=&password=password",
           "spice+tls://localhost:5920",
-          "password may be visible in process listings"},
+          "password may be visible in process listings", NULL},
         { NULL, "5930",
           "localhost",
           NULL, NULL,
           "spice://localhost?port=&tls-port=5930",
-          "spice+tls://localhost:5930" },
+          "spice+tls://localhost:5930",
+          NULL, NULL },
         { "42", NULL,
           "localhost",
           NULL, NULL,
           "spice://localhost:42",
-          "spice://localhost:42" },
+          "spice://localhost:42",
+          NULL, NULL },
         { "42", "5930",
           "localhost",
           NULL, NULL,
           "spice://localhost:42?tls-port=5930",
-          "spice://localhost?port=42&tls-port=5930" },
+          "spice://localhost?port=42&tls-port=5930",
+          NULL, NULL },
         { "42", "5930",
           "127.0.0.1",
           NULL, NULL,
           "spice://127.0.0.1:42?tls-port=5930",
-          "spice://127.0.0.1?port=42&tls-port=5930" },
+          "spice://127.0.0.1?port=42&tls-port=5930",
+          NULL, NULL },
         { .uri_input  = "spice+tls://hostname:39",
           .host = "hostname",
           .tls_port = "39" }
@@ -268,38 +274,44 @@ static void test_session_uri_ipv6_good(void)
           "[2010:836B:4179::836B:4179]",
           NULL, NULL,
           "spice://[2010:836B:4179::836B:4179]?port=5900&tls-port=",
-          "spice://[2010:836B:4179::836B:4179]:5900" },
+          "spice://[2010:836B:4179::836B:4179]:5900",
+          NULL, NULL },
         { "5910", NULL,
           "[::192.9.5.5]",
           "user", NULL,
           "spice://user@[::192.9.5.5]?tls-port=&port=5910",
-          "spice://[::192.9.5.5]:5910" },
+          "spice://[::192.9.5.5]:5910",
+          NULL, NULL },
         { NULL, "5920",
           "[3ffe:2a00:100:7031::1]",
           "user", "password",
           "spice://user@[3ffe:2a00:100:7031::1]?tls-port=5920&port=&password=password",
           "spice+tls://[3ffe:2a00:100:7031::1]:5920",
-          "password may be visible in process listings"},
+          "password may be visible in process listings", NULL},
         { NULL, "5930",
           "[1080:0:0:0:8:800:200C:417A]",
           NULL, NULL,
           "spice://[1080:0:0:0:8:800:200C:417A]?port=&tls-port=5930",
-          "spice+tls://[1080:0:0:0:8:800:200C:417A]:5930" },
+          "spice+tls://[1080:0:0:0:8:800:200C:417A]:5930",
+          NULL, NULL },
         { "42", NULL,
           "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",
           NULL, NULL,
           "spice://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:42",
-          "spice://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:42" },
+          "spice://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:42",
+          NULL, NULL },
         { "42", "5930",
           "[::192.9.5.5]",
           NULL, NULL,
           "spice://[::192.9.5.5]:42?tls-port=5930",
-          "spice://[::192.9.5.5]?port=42&tls-port=5930" },
+          "spice://[::192.9.5.5]?port=42&tls-port=5930",
+          NULL, NULL },
         { "42", "5930",
           "[::FFFF:129.144.52.38]",
           NULL, NULL,
           "spice://[::FFFF:129.144.52.38]:42?tls-port=5930",
-          "spice://[::FFFF:129.144.52.38]?port=42&tls-port=5930" },
+          "spice://[::FFFF:129.144.52.38]?port=42&tls-port=5930",
+          NULL, NULL },
     };
 
     test_session_uri_good(tests, G_N_ELEMENTS(tests));
-- 
2.14.3



More information about the Spice-devel mailing list