]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Disable array bounds checking for GCC
authorMichael Brown <mcb30@ipxe.org>
Wed, 14 Dec 2022 00:51:00 +0000 (00:51 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 14 Dec 2022 00:54:13 +0000 (00:54 +0000)
The array bounds checker on GCC 12 and newer reports a very large
number of false positives that result in build failures.  In
particular, accesses through pointers to zero-length arrays (such as
those used by the linker table mechanism in include/ipxe/tables.h) are
reported as errors, contrary to the GCC documentation.

Work around this GCC issue by unconditionally disabling the warning.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.housekeeping

index 9bf34b2e698f3959c4fc003476aaebe970e67f35..61a9cf07e04707ae48a2b6ac3e9f3695503d511a 100644 (file)
@@ -461,8 +461,8 @@ CFLAGS              += -g
 ifeq ($(CCTYPE),gcc)
 CFLAGS         += -ffreestanding
 CFLAGS         += -fcommon
-CFLAGS         += -Wall -W -Wformat-nonliteral
-HOST_CFLAGS    += -Wall -W -Wformat-nonliteral
+CFLAGS         += -Wall -W -Wformat-nonliteral -Wno-array-bounds
+HOST_CFLAGS    += -Wall -W -Wformat-nonliteral -Wno-array-bounds
 endif
 CFLAGS         += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
 ASFLAGS                += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)