From ee418f1780a29568621dde9cd773daac84b568a9 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 15 Apr 2024 11:57:26 +0100 Subject: [PATCH] usb: Fixed the USB string descriptor internal type appearing and being defined for C++ code, the unsized array member is UB in C++ --- include/libopencm3/usb/usbstd.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/libopencm3/usb/usbstd.h b/include/libopencm3/usb/usbstd.h index 33bdd8b5..27d16417 100644 --- a/include/libopencm3/usb/usbstd.h +++ b/include/libopencm3/usb/usbstd.h @@ -249,11 +249,13 @@ struct usb_endpoint_descriptor { /* Table 9-15 specifies String Descriptor Zero. * Table 9-16 specified UNICODE String Descriptor. */ +#ifndef __cplusplus struct usb_string_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wData[]; } __attribute__((packed)); +#endif /* From ECN: Interface Association Descriptors, Table 9-Z */ struct usb_iface_assoc_descriptor { @@ -275,4 +277,3 @@ enum usb_language_id { #endif /**@}*/ -