Browse Source

[build] Use positive-form tests when checking for supported warnings

Some versions of gcc seem to silently accept an attempt to disable an
unrecognised warning (e.g. via -Wno-stringop-truncation) but will then
report the unrecognised warning if any other error occurs during the
build, resulting in a potentially misleading error message.

Avoid this potential confusion by using the positive-form tests in
order to determine the workaround CFLAGS.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 6 years ago
parent
commit
1c47eb186e
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/Makefile.housekeeping

+ 2
- 2
src/Makefile.housekeeping View File

@@ -174,14 +174,14 @@ endif
174 174
 # Inhibit this.
175 175
 #
176 176
 ifeq ($(CCTYPE),gcc)
177
-WNA_TEST = $(CC) -Wno-address -x c -c /dev/null -o /dev/null >/dev/null 2>&1
177
+WNA_TEST = $(CC) -Waddress -x c -c /dev/null -o /dev/null >/dev/null 2>&1
178 178
 WNA_FLAGS := $(shell $(WNA_TEST) && $(ECHO) '-Wno-address')
179 179
 WORKAROUND_CFLAGS += $(WNA_FLAGS)
180 180
 
181 181
 # gcc 8.0 generates warnings for certain suspect string operations. Our
182 182
 # sources have been vetted for correct usage.  Turn off these warnings.
183 183
 #
184
-WNST_TEST = $(CC) -Wno-stringop-truncation -x c -c /dev/null -o /dev/null \
184
+WNST_TEST = $(CC) -Wstringop-truncation -x c -c /dev/null -o /dev/null \
185 185
 		  >/dev/null 2>&1
186 186
 WNST_FLAGS := $(shell $(WNST_TEST) && $(ECHO) '-Wno-stringop-truncation')
187 187
 WORKAROUND_CFLAGS += $(WNST_FLAGS)

Loading…
Cancel
Save