qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: Fix clang build
@ 2021-01-19 23:07 Eric Blake
  2021-01-19 23:20 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2021-01-19 23:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

../hw/usb/dev-uas.c:157:31: error: field 'status' with variable sized type 'uas_iu' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
    uas_iu                    status;
                              ^

Fix this by specifying a size for the add_cdb member; and at present,
the code does not actually use that field other than for the size
chosen for the packed uas_iu_command struct, and the choice of one
byte does not change the size of the uas_iu union.

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

I'm not sure why none of our CI tools pick up this particular clang
build failure; I hit it on Fedora 33 when configuring to build the
entire tree with clang.

 hw/usb/dev-uas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index cec071d96c49..904d6ffa2938 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -70,7 +70,7 @@ typedef struct {
     uint8_t    reserved_2;
     uint64_t   lun;
     uint8_t    cdb[16];
-    uint8_t    add_cdb[];
+    uint8_t    add_cdb[1];
 } QEMU_PACKED  uas_iu_command;

 typedef struct {
-- 
2.30.0



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

end of thread, other threads:[~2021-01-20  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-19 23:07 [PATCH] usb: Fix clang build Eric Blake
2021-01-19 23:20 ` Philippe Mathieu-Daudé
2021-01-19 23:26   ` Philippe Mathieu-Daudé
2021-01-20  9:49   ` Daniel P. Berrangé

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).