[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 6/8] usbtest: disable gcc9 -Waddress-of-packed-member
From: |
Michael Chang |
Subject: |
[PATCH v2 6/8] usbtest: disable gcc9 -Waddress-of-packed-member |
Date: |
Thu, 11 Apr 2019 17:14:07 +0800 |
Disable the -Wadress-of-packaed-member diagnostic for the
grub_usb_get_string function since the result is false postive. The
descstrp->str is found to be aligned in the buffer allocated for 'struct
grub_usb_desc_str'.
[ 229s] ../../grub-core/commands/usbtest.c: In function 'grub_usb_get_string':
[ 229s] ../../grub-core/commands/usbtest.c:104:58: error: taking address of
packed member of 'struct grub_usb_desc_str' may result in an unaligned pointer
value [-Werror=address-of-packed-member]
[ 229s] 104 | *grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str,
[ 229s] | ~~~~~~~~^~~~~
Signed-off-by: Michael Chang <address@hidden>
---
grub-core/commands/usbtest.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/grub-core/commands/usbtest.c b/grub-core/commands/usbtest.c
index 01cdca934..2c6d93fe6 100644
--- a/grub-core/commands/usbtest.c
+++ b/grub-core/commands/usbtest.c
@@ -63,6 +63,11 @@ static const char *usb_devspeed[] =
"High"
};
+#if __GNUC__ >= 9
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
+
static grub_usb_err_t
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
char **string)
@@ -108,6 +113,10 @@ grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t
index, int langid,
return GRUB_USB_ERR_NONE;
}
+#if __GNUC__ >= 9
+#pragma GCC diagnostic pop
+#endif
+
static void
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
{
--
2.16.4
- [PATCH v2 0/8] fix gcc9 build with -Werror=address-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 7/8] chainloader: fix gcc9 error -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 3/8] hfs: fix gcc9 error -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 4/8] hfsplus: fix gcc9 error with -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 8/8] efi: fix gcc9 error -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 2/8] jfs: disable gcc9 -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 5/8] acpi: fix gcc9 error -Waddress-of-packed-member, Michael Chang, 2019/04/11
- [PATCH v2 6/8] usbtest: disable gcc9 -Waddress-of-packed-member,
Michael Chang <=
- [PATCH v2 1/8] cpio: disable gcc9 -Waddress-of-packed-member, Michael Chang, 2019/04/11
- Re: [PATCH v2 0/8] fix gcc9 build with -Werror=address-of-packed-member, Daniel Kiper, 2019/04/18