[ipxe-devel] [PATCH] [build] Disable gcc address of packed member warning

Bruce Rogers brogers at suse.com
Fri Jan 25 17:56:38 UTC 2019


GCC 9.0 introduces a new warning for using pointers to packed
structure and union members. ipxe code is replete with this usage,
partly because the architectures it is designed for handle unaligned
accesses. Therefore this warning is not very helpful and since the
default build considers warnings to be errors, needs to be disabled.

Signed-off-by: Bruce Rogers <brogers at suse.com>
---
 src/Makefile.housekeeping | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index f8334921..e7f1ece0 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -185,6 +185,17 @@ WNST_TEST = $(CC) -Wstringop-truncation -x c -c /dev/null -o /dev/null \
 		  >/dev/null 2>&1
 WNST_FLAGS := $(shell $(WNST_TEST) && $(ECHO) '-Wno-stringop-truncation')
 WORKAROUND_CFLAGS += $(WNST_FLAGS)
+
+# GCC 9.0 introduces a new warning for using pointers to packed
+# structure and union members. ipxe code is replete with this usage,
+# partly because the architectures it is designed for handle unaligned
+# accesses. Therefore this warning is not very helpful and since the 
+# default build considers warnings to be errors, needs to be disabled.
+#
+WNAOPM_TEST = $(CC) -Waddress-of-packed-member -x c -c /dev/null -o /dev/null \
+		  >/dev/null 2>&1
+WNAOPM_FLAGS := $(shell $(WNAOPM_TEST) && $(ECHO) '-Wno-address-of-packed-member')
+WORKAROUND_CFLAGS += $(WNAOPM_FLAGS)
 endif
 
 # Some versions of gas choke on division operators, treating them as
-- 
2.20.1




More information about the ipxe-devel mailing list