kbuild, LLVMLinux: Add -Werror to cc-option to support clang
PATCH 1/1 kbuild, LLVMLinux: Add -Werror to cc-option to support clang
From: Mark Charlebois <[email protected]>
Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed.
Adding -Werror make both compiler behave the same.
[arnd: it turns out we need the same patch for testing whether -ffunction-sections
works right with gcc. I've build tested extensively with this patch applied, so let's just merge this one now.]
--- scripts/Kbuild.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/Kbuild.include +3 -3
@@ -109,17 +109,17 @@ as-instr = $(call try-run,\ # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) $(KBUILD_CPPFLAGS) $(CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-version # Usage gcc-ver := $(call cc-version)
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 20 lines · Ahmad Fatoum
From: Mark Charlebois <[email protected]>
Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed.
Adding -Werror make both compiler behave the same.
[arnd: it turns out we need the same patch for testing whether -ffunction-sections
works right with gcc. I've build tested extensively with this patch applied, so let's just merge this one now.]Signed-off-by Mark Charlebois <[email protected]>Signed-off-by Behan Webster <[email protected]>Reviewed-by Jan-Simon Möller <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>Acked-by Kees Cook <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>[afa: ported to barebox from upstream c3f0d0bc5b01ad9]Signed-off-by Ahmad Fatoum <[email protected]>
Quoted 3 lines
--- scripts/Kbuild.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox