]> xenbits.xensource.com Git - people/aperard/qemu-dm.git/commitdiff
configure: Expand test which disable -Wmissing-braces fix-build-clang-6
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 5 Jan 2023 13:37:31 +0000 (14:37 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Thu, 5 Jan 2023 13:37:31 +0000 (14:37 +0100)
With "clang 6.0.0-1ubuntu2" on Ubuntu Bionic, the test with build
fine, but clang still suggest braces around the zero initializer in a
few places, where there is a subobject. Expand test to include a sub
struct which doesn't build on clang 6.0.0-1ubuntu2, and give:
    config-temp/qemu-conf.c:7:8: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    } x = {0};
           ^
           {}

These are the error reported by clang on QEMU's code (v7.2.0):
hw/pci-bridge/cxl_downstream.c:101:51: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    dvsec = (uint8_t *)&(CXLDVSECPortExtensions){ 0 };

hw/pci-bridge/cxl_root_port.c:62:51: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    dvsec = (uint8_t *)&(CXLDVSECPortExtensions){ 0 };

tests/qtest/virtio-net-test.c:322:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    QOSGraphTestOptions opts = { 0 };

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
configure

index 9f0bc57546de8f2ecd1545e75433a06a0526901d..3cd9b8bad46ca942de837a8dba69ee3627b08ada 100755 (executable)
--- a/configure
+++ b/configure
@@ -1290,7 +1290,11 @@ fi
 # Disable -Wmissing-braces on older compilers that warn even for
 # the "universal" C zero initializer {0}.
 cat > $TMPC << EOF
+struct s {
+  void *a;
+};
 struct {
+  struct s s;
   int a[2];
 } x = {0};
 EOF