diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-10-12 09:19:11 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-10-12 09:23:37 -0400 |
commit | 94d6265df08c0401d77f6b86080789a6699c1f8c (patch) | |
tree | a089f88c57ed73b881f6efd31d0ffd8ad5cb6682 | |
parent | 8b9ef7cf8db28f426d2b7dbd3b4d56c46f2efeb4 (diff) | |
download | rockbox-94d6265df0.tar.gz rockbox-94d6265df0.zip |
gcc9: Move structure packing to the struct definition
Silences GCC9 warnings about possible casting misalignments.
Change-Id: I2120638d4d143e9e539b7f240c31653ad55ae4e0
-rw-r--r-- | firmware/export/ata.h | 2 | ||||
-rw-r--r-- | firmware/export/usb_ch9.h | 2 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 17 |
3 files changed, 9 insertions, 12 deletions
diff --git a/firmware/export/ata.h b/firmware/export/ata.h index 6165eaf633..8ae28fc191 100644 --- a/firmware/export/ata.h +++ b/firmware/export/ata.h @@ -101,7 +101,7 @@ struct ata_smart_values unsigned char reserved_375_385[11]; unsigned char vendor_specific_386_510[125]; unsigned char chksum; -} __attribute__((packed)); +} __attribute__((packed)) __attribute__((aligned(2))); /* Raw attribute value print formats */ enum ata_attr_raw_format diff --git a/firmware/export/usb_ch9.h b/firmware/export/usb_ch9.h index 659bcca101..db311c592e 100644 --- a/firmware/export/usb_ch9.h +++ b/firmware/export/usb_ch9.h @@ -292,7 +292,7 @@ struct usb_string_descriptor { uint8_t bDescriptorType; uint16_t wString[]; /* UTF-16LE encoded */ -} __attribute__ ((packed)); +} __attribute__ ((packed)) __attribute__((aligned(2))); /* note that "string" zero is special, it holds language codes that * the device supports, not Unicode characters. diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index b4a117d959..92cdeb9a59 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -119,16 +119,13 @@ static const struct usb_qualifier_descriptor __attribute__((aligned(2))) .bNumConfigurations = 1 }; -static const struct usb_string_descriptor __attribute__((aligned(2))) - usb_string_iManufacturer = +static const struct usb_string_descriptor usb_string_iManufacturer = USB_STRING_INITIALIZER(u"Rockbox.org"); -static const struct usb_string_descriptor __attribute__((aligned(2))) - usb_string_iProduct = +static const struct usb_string_descriptor usb_string_iProduct = USB_STRING_INITIALIZER(u"Rockbox media player"); -static struct usb_string_descriptor __attribute__((aligned(2))) - usb_string_iSerial = +static struct usb_string_descriptor usb_string_iSerial = USB_STRING_INITIALIZER(u"00000000000000000000000000000000000000000"); /* Generic for all targets */ @@ -523,11 +520,11 @@ void usb_core_hotswap_event(int volume, bool inserted) static void usb_core_set_serial_function_id(void) { int i, id = 0; - + for(i = 0; i < USB_NUM_DRIVERS; i++) if(drivers[i].enabled) id |= 1 << i; - + usb_string_iSerial.wString[0] = hex[id]; } @@ -856,10 +853,10 @@ static void request_handler_endpoint_drivers(struct usb_ctrlrequest* req, void* if(EP_NUM(req->wIndex) < USB_NUM_ENDPOINTS) control_handler = ep_data[EP_NUM(req->wIndex)].control_handler[EP_DIR(req->wIndex)]; - + if(control_handler) handled = control_handler(req, reqdata, response_data); - + if(!handled) { /* nope. flag error */ logf("usb bad req %d", req->bRequest); |