Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hEVmz-0003eo-9k for mharc-grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEVmt-0003aD-FK for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEVms-0001JK-Cy for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:27 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:46907) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hEVmr-0001Hp-VL for grub-devel@gnu.org; Thu, 11 Apr 2019 05:14:26 -0400 Received: from mercury.suse.de (prva10-snat226-2.provo.novell.com [137.65.226.36]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Thu, 11 Apr 2019 03:14:17 -0600 From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH v2 6/8] usbtest: disable gcc9 -Waddress-of-packed-member Date: Thu, 11 Apr 2019 17:14:07 +0800 Message-Id: <20190411091409.17129-7-mchang@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190411091409.17129-1-mchang@suse.com> References: <20190411091409.17129-1-mchang@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2019 09:14:28 -0000 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 --- 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