Browse Source

[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>
tags/v1.20.1
Bruce Rogers 6 years ago
parent
commit
8ed4e3049f
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      src/Makefile.housekeeping

+ 9
- 1
src/Makefile.housekeeping View File

177
 WNA_TEST = $(CC) -Wno-address -x c -c /dev/null -o /dev/null >/dev/null 2>&1
177
 WNA_TEST = $(CC) -Wno-address -x c -c /dev/null -o /dev/null >/dev/null 2>&1
178
 WNA_FLAGS := $(shell $(WNA_TEST) && $(ECHO) '-Wno-address')
178
 WNA_FLAGS := $(shell $(WNA_TEST) && $(ECHO) '-Wno-address')
179
 WORKAROUND_CFLAGS += $(WNA_FLAGS)
179
 WORKAROUND_CFLAGS += $(WNA_FLAGS)
180
+
181
+# gcc 8.0 generates warnings for certain suspect string operations. Our
182
+# sources have been vetted for correct usage.  Turn off these warnings.
183
+#
184
+WNST_TEST = $(CC) -Wno-stringop-truncation -x c -c /dev/null -o /dev/null \
185
+		  >/dev/null 2>&1
186
+WNST_FLAGS := $(shell $(WNST_TEST) && $(ECHO) '-Wno-stringop-truncation')
187
+WORKAROUND_CFLAGS += $(WNST_FLAGS)
180
 endif
188
 endif
181
 
189
 
182
 # Some versions of gas choke on division operators, treating them as
190
 # Some versions of gas choke on division operators, treating them as
437
 CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
445
 CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
438
 ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
446
 ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
439
 LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
447
 LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
440
-HOST_CFLAGS	+= -O2 -g
448
+HOST_CFLAGS	+= $(WORKAROUND_CFLAGS) -O2 -g
441
 
449
 
442
 # Inhibit -Werror if NO_WERROR is specified on make command line
450
 # Inhibit -Werror if NO_WERROR is specified on make command line
443
 #
451
 #

Loading…
Cancel
Save