Skip to content
Browse files
[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 <>
Modified-by: Michael Brown <>
Also-fixed-by: Christian Hesse <>
Also-fixed-by: Roman Kagan <>
Also-fixed-by: Bernhard M. Wiedemann <>
Also-fixed-by: Olaf Hering <>
Signed-off-by: Michael Brown <>
  • Loading branch information
bfrogers authored and mcb30 committed Jul 7, 2018
1 parent e7f67d5 commit 8ed4e3049f5fcb3a0b32f5190940e78c61654cff
Showing 1 changed file with 9 additions and 1 deletion.
@@ -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')

# 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')

# Some versions of gas choke on division operators, treating them as
@@ -437,7 +445,7 @@ endif

# Inhibit -Werror if NO_WERROR is specified on make command line

0 comments on commit 8ed4e30

Please sign in to comment.