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 <m...@redhat.com>
Signed-off-by: Richard Henderson <richard.hender...@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 <ebl...@redhat.com>

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

Reply via email to