LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ipxe.8ed4e3049f5fcb3a0b32f5190940e78c61654cff.patch of Package qemu-2.7 (Project home:olh:xen-buildrequires)

From: Bruce Rogers <brogers@suse.com>
Date: Tue, 24 Apr 2018 08:47:32 -0600
Subject: 8ed4e3049f5fcb3a0b32f5190940e78c61654cff

[build] Disable gcc stringop-truncation warnings

The gcc 8 compiler introduces a warning for certain string
manipulation functions, flagging usages which _may_ not be intended.
An audit of the iPXE sources indicates all usages of strncat and
strncpy are as intended, so the warnings currently issued are not
helpful, especially if warnings are considered errors.

Fix by detecting gcc's support for -Wno-stringop-truncation and, if
detected, using that option to avoid the warning.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Also-fixed-by: Christian Hesse <list@eworm.de>
Also-fixed-by: Roman Kagan <rkagan@virtuozzo.com>
Also-fixed-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Also-fixed-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
---
 src/Makefile.housekeeping | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -177,6 +177,14 @@ 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)
+
+# gcc 8.0 generates warnings for certain suspect string operations. Our
+# sources have been vetted for correct usage.  Turn off these warnings.
+#
+WNST_TEST = $(CC) -Wno-stringop-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)
 endif
 
 # Some versions of gas choke on division operators, treating them as
@@ -424,7 +432,7 @@ endif
 CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
 ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
 LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
-HOST_CFLAGS	+= -O2 -g
+HOST_CFLAGS	+= $(WORKAROUND_CFLAGS) -O2 -g
 
 # Inhibit -Werror if NO_WERROR is specified on make command line
 #