Skip to content

Commit

Permalink
usb: Fixed the USB string descriptor internal type appearing and bein…
Browse files Browse the repository at this point in the history
…g defined for C++ code, the unsized array member is UB in C++
  • Loading branch information
dragonmux committed Aug 11, 2024
1 parent 9897a4f commit 333df7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/libopencm3/usb/usbstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -275,4 +277,3 @@ enum usb_language_id {
#endif

/**@}*/

0 comments on commit 333df7a

Please sign in to comment.