[PATCH 1/5] tests: fix warning with old GCC about missing struct initializer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Old GCC isn't happy about the {0} initializer because the first
field in the struct is itself a struct.

../../tests/openvzutilstest.c: In function 'testReadNetworkConf':
../../tests/openvzutilstest.c:101:12: error: missing braces around initializer [-Werror=missing-braces]
     struct openvz_driver driver = {0};
            ^

This fixes commit 4a4132b4625778cf80acb9c92d06351b44468ac3

Signed-off-by: Daniel Berrange <berrange@localhost.localdomain>
---
 tests/openvzutilstest.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index c395b9dc19..2b1a9fb5ce 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -98,10 +98,10 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED)
         "    </interface>\n"
         "  </devices>\n"
         "</domain>\n";
-    struct openvz_driver driver = {0};
-
-    driver.xmlopt = openvzXMLOption(&driver);
-    driver.caps = openvzCapsInit();
+    struct openvz_driver driver = {
+        .xmlopt = openvzXMLOption(&driver),
+        .caps = openvzCapsInit(),
+    };
 
     if (!(def = virDomainDefNew()))
         goto cleanup;
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux