]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Enable strict shift overflow warnings 1793/head
authorMichael Brown <mcb30@ipxe.org>
Mon, 3 Aug 2026 22:52:01 +0000 (23:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 3 Aug 2026 23:19:00 +0000 (00:19 +0100)
Left shifts into the sign bit are often reported as potential
undefined behaviour by automated tools, which distracts from real
issues.

Now that all offending constant left shifts have been eliminated from
the codebase, enable -Wshift-overflow=2 to ensure that such shifts
cannot be reintroduced in future.

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

index ed2100869938917a3c80ac7611b1a7cbeab9cc56..ddd4c8a663050f6f98323ee640901e936e23eb09 100644 (file)
@@ -488,9 +488,9 @@ CFLAGS              += -g
 ifeq ($(CCTYPE),gcc)
 CFLAGS         += -ffreestanding
 CFLAGS         += -fno-common
-CFLAGS         += -Wall -W -Wformat-nonliteral
+CFLAGS         += -Wall -W -Wformat-nonliteral -Wshift-overflow=2
 CFLAGS         += -Wno-array-bounds -Wno-dangling-pointer
-HOST_CFLAGS    += -Wall -W -Wformat-nonliteral
+HOST_CFLAGS    += -Wall -W -Wformat-nonliteral -Wshift-overflow=2
 HOST_CFLAGS    += -Wno-array-bounds -Wno-dangling-pointer
 endif
 CFLAGS         += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)