]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Disable gcc unterminated-string-initializer warnings 1457/head
authorMichael Brown <mcb30@ipxe.org>
Sun, 27 Apr 2025 17:01:24 +0000 (18:01 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 27 Apr 2025 17:40:52 +0000 (18:40 +0100)
GCC 15 generates a warning when a string initializer is too large to
allow for a trailing NUL terminator byte.  This type of initializer is
fairly common in signature strings such as ACPI table identifiers.

Fix by disabling the warning.

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

index 11aab7a50dcd68e47d027ec22156b7f21816c661..b291732135f5838cf9521ecb31bcbd88eb1c8227 100644 (file)
@@ -368,6 +368,15 @@ WNAPM_FLAGS := $(shell $(WNAPM_TEST) && \
 WORKAROUND_CFLAGS += $(WNAPM_FLAGS)
 endif
 
+# gcc 15 generates warnings for fixed-length character array
+# initializers that lack a terminating NUL.  Inhibit the warnings.
+#
+WNUSI_TEST = $(CC) -Wunterminated-string-initialization -x c -c /dev/null \
+                  -o /dev/null >/dev/null 2>&1
+WNUSI_FLAGS := $(shell $(WNUSI_TEST) && \
+                $(ECHO) '-Wno-unterminated-string-initialization')
+WORKAROUND_CFLAGS += $(WNUSI_FLAGS)
+
 # 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.