summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-11-29 19:47:59 +0200
committerTom Rini <trini@konsulko.com>2020-01-10 14:18:26 -0500
commit53dc8ae66c5ca8dac65bd6f51c0cbb8b0d22aa2a (patch)
treebe016a0762da87a0a7099997acbd40d5c0cb4d0c
parent68af8106a337b708a181662de42bddc36d5aec71 (diff)
downloadu-boot-53dc8ae66c5ca8dac65bd6f51c0cbb8b0d22aa2a.tar.gz
u-boot-53dc8ae66c5ca8dac65bd6f51c0cbb8b0d22aa2a.tar.xz
u-boot-53dc8ae66c5ca8dac65bd6f51c0cbb8b0d22aa2a.zip
gcc-9: silence 'address-of-packed-member' warning
GCC 9.x starts complaining about potential misalignment of the pointer to the array (in this case alignment=2) in the packed (alignment=1) structures. Repeating Linus' Torvalds commit 6f303d60534c in the Linux kernel. Original commit message: We already did this for clang, but now gcc has that warning too. Yes, yes, the address may be unaligned. And that's kind of the point. This in particular hides the warnings like drivers/usb/gadget/composite.c:545:23: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 545 | collect_langs(sp, s->wData); drivers/usb/gadget/composite.c:550:24: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 550 | collect_langs(sp, s->wData); drivers/usb/gadget/composite.c:555:25: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 555 | collect_langs(sp, s->wData); Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index cc126ebc53..3f332e6885 100644
--- a/Makefile
+++ b/Makefile
@@ -672,11 +672,12 @@ endif
endif
KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
+KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
+
ifeq ($(cc-name),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
-KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
endif