qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0
@ 2018-05-12  1:48 Richard Henderson
  2018-05-12  1:48 ` [Qemu-devel] [PATCH 2/2] target/s390x: " Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Richard Henderson @ 2018-05-12  1:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S . Tsirkin

The warning is

hw/virtio/vhost-user.c:1319:26: error: suggest braces
      around initialization of subobject [-Werror,-Wmissing-braces]
    VhostUserMsg msg = { 0 };
                         ^
                         {}

While the original code is correct, and technically exactly correct
as per ISO C89, both GCC and Clang support plain empty set of braces
as an extension.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 38da8692bb..b455fca394 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1316,7 +1316,7 @@ static bool vhost_user_requires_shm_log(struct vhost_dev *dev)
 
 static int vhost_user_migration_done(struct vhost_dev *dev, char* mac_addr)
 {
-    VhostUserMsg msg = { 0 };
+    VhostUserMsg msg = { };
 
     assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/2] target/s390x: Fix brace Werror with clang 6.0.0
  2018-05-12  1:48 [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0 Richard Henderson
@ 2018-05-12  1:48 ` Richard Henderson
  2018-05-14 15:44   ` Philippe Mathieu-Daudé
  2018-05-14 15:44 ` [Qemu-devel] [PATCH 1/2] hw/virtio: " Philippe Mathieu-Daudé
  2018-05-15 15:03 ` Eric Blake
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2018-05-12  1:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, David Hildenbrand, Cornelia Huck

The warning is

target/s390x/misc_helper.c:209:21: error: suggest
      braces around initialization of subobject [-Werror,-Wmissing-braces]
    SysIB sysib = { 0 };
                    ^
                    {}

While the original code is correct, and technically exactly correct
as per ISO C89, both GCC and Clang support plain empty set of braces
as an extension.

Cc: Alexander Graf <agraf@suse.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/s390x/misc_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c
index e0b23c1fd1..1f834f35ef 100644
--- a/target/s390x/misc_helper.c
+++ b/target/s390x/misc_helper.c
@@ -206,7 +206,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)
     const MachineState *ms = MACHINE(qdev_get_machine());
     uint16_t total_cpus = 0, conf_cpus = 0, reserved_cpus = 0;
     S390CPU *cpu = s390_env_get_cpu(env);
-    SysIB sysib = { 0 };
+    SysIB sysib = { };
     int i, cc = 0;
 
     if ((r0 & STSI_R0_FC_MASK) > STSI_R0_FC_LEVEL_3) {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0
  2018-05-12  4:59 [Qemu-devel] [PATCH 0/9] target/m68k: Convert to TranslatorOps Richard Henderson
@ 2018-05-12  4:59 ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2018-05-12  4:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, Michael S . Tsirkin

The warning is

hw/virtio/vhost-user.c:1319:26: error: suggest braces
      around initialization of subobject [-Werror,-Wmissing-braces]
    VhostUserMsg msg = { 0 };
                         ^
                         {}

While the original code is correct, and technically exactly correct
as per ISO C89, both GCC and Clang support plain empty set of braces
as an extension.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 38da8692bb..b455fca394 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1316,7 +1316,7 @@ static bool vhost_user_requires_shm_log(struct vhost_dev *dev)
 
 static int vhost_user_migration_done(struct vhost_dev *dev, char* mac_addr)
 {
-    VhostUserMsg msg = { 0 };
+    VhostUserMsg msg = { };
 
     assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] target/s390x: Fix brace Werror with clang 6.0.0
  2018-05-12  1:48 ` [Qemu-devel] [PATCH 2/2] target/s390x: " Richard Henderson
@ 2018-05-14 15:44   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-14 15:44 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel
  Cc: Cornelia Huck, Alexander Graf, David Hildenbrand

On 05/11/2018 10:48 PM, Richard Henderson wrote:
> The warning is
> 
> target/s390x/misc_helper.c:209:21: error: suggest
>       braces around initialization of subobject [-Werror,-Wmissing-braces]
>     SysIB sysib = { 0 };
>                     ^
>                     {}
> 
> While the original code is correct, and technically exactly correct
> as per ISO C89, both GCC and Clang support plain empty set of braces
> as an extension.
> 
> Cc: Alexander Graf <agraf@suse.de>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  target/s390x/misc_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c
> index e0b23c1fd1..1f834f35ef 100644
> --- a/target/s390x/misc_helper.c
> +++ b/target/s390x/misc_helper.c
> @@ -206,7 +206,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)
>      const MachineState *ms = MACHINE(qdev_get_machine());
>      uint16_t total_cpus = 0, conf_cpus = 0, reserved_cpus = 0;
>      S390CPU *cpu = s390_env_get_cpu(env);
> -    SysIB sysib = { 0 };
> +    SysIB sysib = { };
>      int i, cc = 0;
>  
>      if ((r0 & STSI_R0_FC_MASK) > STSI_R0_FC_LEVEL_3) {
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0
  2018-05-12  1:48 [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0 Richard Henderson
  2018-05-12  1:48 ` [Qemu-devel] [PATCH 2/2] target/s390x: " Richard Henderson
@ 2018-05-14 15:44 ` Philippe Mathieu-Daudé
  2018-05-15 15:03 ` Eric Blake
  2 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-14 15:44 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Michael S . Tsirkin

On 05/11/2018 10:48 PM, Richard Henderson wrote:
> The warning is
> 
> hw/virtio/vhost-user.c:1319:26: error: suggest braces
>       around initialization of subobject [-Werror,-Wmissing-braces]
>     VhostUserMsg msg = { 0 };
>                          ^
>                          {}
> 
> While the original code is correct, and technically exactly correct
> as per ISO C89, both GCC and Clang support plain empty set of braces
> as an extension.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  hw/virtio/vhost-user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 38da8692bb..b455fca394 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -1316,7 +1316,7 @@ static bool vhost_user_requires_shm_log(struct vhost_dev *dev)
>  
>  static int vhost_user_migration_done(struct vhost_dev *dev, char* mac_addr)
>  {
> -    VhostUserMsg msg = { 0 };
> +    VhostUserMsg msg = { };
>  
>      assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
>  
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0
  2018-05-12  1:48 [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0 Richard Henderson
  2018-05-12  1:48 ` [Qemu-devel] [PATCH 2/2] target/s390x: " Richard Henderson
  2018-05-14 15:44 ` [Qemu-devel] [PATCH 1/2] hw/virtio: " Philippe Mathieu-Daudé
@ 2018-05-15 15:03 ` Eric Blake
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2018-05-15 15:03 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Michael S . Tsirkin

On 05/11/2018 08:48 PM, Richard Henderson wrote:
> The warning is
> 
> hw/virtio/vhost-user.c:1319:26: error: suggest braces
>        around initialization of subobject [-Werror,-Wmissing-braces]
>      VhostUserMsg msg = { 0 };
>                           ^
>                           {}
> 
> While the original code is correct, and technically exactly correct
> as per ISO C89, both GCC and Clang support plain empty set of braces

s/C89/C99/ (the guarantee of a universal {0} initializer was only added 
in C99, if I recall correctly)

> as an extension.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   hw/virtio/vhost-user.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

It's annoying that we have to work around clang's bogus warning by 
resorting to an extension.  But such is life.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-15 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-12  1:48 [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0 Richard Henderson
2018-05-12  1:48 ` [Qemu-devel] [PATCH 2/2] target/s390x: " Richard Henderson
2018-05-14 15:44   ` Philippe Mathieu-Daudé
2018-05-14 15:44 ` [Qemu-devel] [PATCH 1/2] hw/virtio: " Philippe Mathieu-Daudé
2018-05-15 15:03 ` Eric Blake
  -- strict thread matches above, loose matches on Subject: below --
2018-05-12  4:59 [Qemu-devel] [PATCH 0/9] target/m68k: Convert to TranslatorOps Richard Henderson
2018-05-12  4:59 ` [Qemu-devel] [PATCH 1/2] hw/virtio: Fix brace Werror with clang 6.0.0 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).