diff options
| author | Mark Charlebois <charlebm@gmail.com> | 2017-03-31 16:38:13 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-04-11 15:34:20 -0400 |
| commit | c3f0d0bc5b01ad90c45276952802455750444b4f (patch) | |
| tree | 7f53cbdb854bcedda725c0ea8ff17c0285247ceb /scripts/Kbuild.include | |
| parent | c834f0e8a8bb3025aac38e802fca2e686720f544 (diff) | |
kbuild, LLVMLinux: Add -Werror to cc-option to support clang
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 <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/Kbuild.include')
| -rw-r--r-- | scripts/Kbuild.include | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d6ca649cb0e9..a70fd26204de 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) | |||
| 116 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 116 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
| 117 | 117 | ||
| 118 | cc-option = $(call try-run,\ | 118 | cc-option = $(call try-run,\ |
| 119 | $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) | 119 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) |
| 120 | 120 | ||
| 121 | # cc-option-yn | 121 | # cc-option-yn |
| 122 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) | 122 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
| 123 | cc-option-yn = $(call try-run,\ | 123 | cc-option-yn = $(call try-run,\ |
| 124 | $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) | 124 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) |
| 125 | 125 | ||
| 126 | # cc-option-align | 126 | # cc-option-align |
| 127 | # Prefix align with either -falign or -malign | 127 | # Prefix align with either -falign or -malign |
| @@ -131,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\ | |||
| 131 | # cc-disable-warning | 131 | # cc-disable-warning |
| 132 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) | 132 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) |
| 133 | cc-disable-warning = $(call try-run,\ | 133 | cc-disable-warning = $(call try-run,\ |
| 134 | $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) | 134 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) |
| 135 | 135 | ||
| 136 | # cc-name | 136 | # cc-name |
| 137 | # Expands to either gcc or clang | 137 | # Expands to either gcc or clang |
