diff mbox series

[13/15] Makefile: Add -Werror to try-cflag so it works on clang

Message ID 20200612022452.371685-14-oohall@gmail.com
State Accepted
Headers show
Series [01/15] test/qemu: Update command line arguments | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (fe70fbb78d33abea788a3221bc409a7c50c019c3)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Oliver O'Halloran June 12, 2020, 2:24 a.m. UTC
Clangs prints warnings when it sees unknown command line options. Adding
-Werror to the command line to upgrade them to errors results in clang
exiting with exit code 1 which is what try-cflag expects.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 Makefile.main | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile.main b/Makefile.main
index bf0fcfaebf76..ec69b2d2c882 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -20,8 +20,8 @@  try = $(shell set -e; if ($(1)) >/dev/null 2>&1; \
 	then echo "$(2)"; \
 	else echo "$(3)"; fi )
 
-try-cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,$(2))
-test_cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,1,0)
+try-cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,$(2))
+test_cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,1,0)
 
 cc-name := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)