[libvirt] [PATCH] Fix build with clang 6.0.0

Roman Bogorodskiy posted 1 patch 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180311153800.37755-1-bogorodskiy@gmail.com
Test syntax-check passed
src/conf/domain_addr.c | 2 +-
tests/sysinfotest.c    | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] Fix build with clang 6.0.0
Posted by Roman Bogorodskiy 6 years, 1 month ago
Clang 6.0.0 complains when initializing structure with { NULL }:

conf/domain_addr.c:1494:38: error: missing field 'type' initializer [-Werror,-Wmissing-field-initializers]
    virDomainDeviceInfo nfo = { NULL };

Use { 0 } instead to make it happy.
---
 src/conf/domain_addr.c | 2 +-
 tests/sysinfotest.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 5e875a3e6..0c914fe25 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1491,7 +1491,7 @@ virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
                                 bool portOnly)
 {
     int ret = -1;
-    virDomainDeviceInfo nfo = { NULL };
+    virDomainDeviceInfo nfo = { 0 };
     virDomainDeviceInfoPtr ptr = allowZero ? &nfo : info;
 
     ptr->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL;
diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index a61da017c..53d5725fd 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -91,7 +91,7 @@ sysinfotest_run(const char *test,
                 const char *cpuinfo,
                 const char *expected)
 {
-    struct testSysinfoData testdata = { NULL };
+    struct testSysinfoData testdata = { 0 };
     int ret = EXIT_FAILURE;
 
     testdata.func = func;
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix build with clang 6.0.0
Posted by Michal Privoznik 6 years, 1 month ago
On 03/11/2018 04:38 PM, Roman Bogorodskiy wrote:
> Clang 6.0.0 complains when initializing structure with { NULL }:
> 
> conf/domain_addr.c:1494:38: error: missing field 'type' initializer [-Werror,-Wmissing-field-initializers]
>     virDomainDeviceInfo nfo = { NULL };
> 
> Use { 0 } instead to make it happy.
> ---
>  src/conf/domain_addr.c | 2 +-
>  tests/sysinfotest.c    | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix build with clang 6.0.0
Posted by Roman Bogorodskiy 6 years, 1 month ago
  Michal Privoznik wrote:

> On 03/11/2018 04:38 PM, Roman Bogorodskiy wrote:
> > Clang 6.0.0 complains when initializing structure with { NULL }:
> > 
> > conf/domain_addr.c:1494:38: error: missing field 'type' initializer [-Werror,-Wmissing-field-initializers]
> >     virDomainDeviceInfo nfo = { NULL };
> > 
> > Use { 0 } instead to make it happy.
> > ---
> >  src/conf/domain_addr.c | 2 +-
> >  tests/sysinfotest.c    | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> ACK

Pushed, thanks!

> Michal

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