]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Avoid spurious address comparison warnings in gcc 4.6
authorMichael Brown <mcb30@ipxe.org>
Wed, 16 Mar 2011 18:10:49 +0000 (18:10 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 16 Mar 2011 19:32:17 +0000 (19:32 +0000)
A construction such as "assert ( ptr != NULL )" seems to trigger a
false positive warning in gcc 4.6 if the value of "ptr" is known at
compile-time to be non-NULL.  Use -Wno-address to inhibit this
warning.

Reported-by: Ralph Giles <giles@thaumas.net>
Tested-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.housekeeping

index 78e78c993146068e1781959c2f8ee5f208f0c701..964d50098cf37548b81350b10de5d2116fe6a144 100644 (file)
@@ -148,6 +148,15 @@ CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
 WORKAROUND_CFLAGS += $(CFI_FLAGS)
 endif
 
+# gcc 4.6 generates spurious warnings if -Waddress is in force.
+# Inhibit this.
+#
+ifeq ($(CCTYPE),gcc)
+WNA_TEST = $(CC) -Wno-address -x c -c /dev/null -o /dev/null >/dev/null 2>&1
+WNA_FLAGS := $(shell $(WNA_TEST) && $(ECHO) '-Wno-address')
+WORKAROUND_CFLAGS += $(WNA_FLAGS)
+endif
+
 # Some versions of gas choke on division operators, treating them as
 # comment markers.  Specifying --divide will work around this problem,
 # but isn't available on older gas versions.