Commit a1494304 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: add all Clang-specific flags unconditionally

We do not support old Clang versions. Upgrade your clang version
if any of these flags is unsupported.

Let's add all flags inside ifdef CONFIG_CC_IS_CLANG unconditionally.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
parent 7eb8e5f0
...@@ -731,15 +731,15 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong ...@@ -731,15 +731,15 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
KBUILD_CFLAGS += $(stackp-flags-y) KBUILD_CFLAGS += $(stackp-flags-y)
ifdef CONFIG_CC_IS_CLANG ifdef CONFIG_CC_IS_CLANG
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CPPFLAGS += -Qunused-arguments
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += -Wno-format-invalid-specifier
KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += -Wno-gnu
# Quiet clang warning: comparison of unsigned expression < 0 is always false # Quiet clang warning: comparison of unsigned expression < 0 is always false
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) KBUILD_CFLAGS += -Wno-tautological-compare
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # source of a reference will be _MergedGlobals and not on of the whitelisted names.
# See modpost pattern 2 # See modpost pattern 2
KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += -mno-global-merge
else else
# These warnings generated too much noise in a regular build. # These warnings generated too much noise in a regular build.
......
...@@ -67,11 +67,11 @@ KBUILD_CFLAGS += $(warning) ...@@ -67,11 +67,11 @@ KBUILD_CFLAGS += $(warning)
else else
ifdef CONFIG_CC_IS_CLANG ifdef CONFIG_CC_IS_CLANG
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) KBUILD_CFLAGS += -Wno-initializer-overrides
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) KBUILD_CFLAGS += -Wno-unused-value
KBUILD_CFLAGS += $(call cc-disable-warning, format) KBUILD_CFLAGS += -Wno-format
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) KBUILD_CFLAGS += -Wno-sign-compare
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) KBUILD_CFLAGS += -Wno-format-zero-length
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) KBUILD_CFLAGS += -Wno-uninitialized
endif endif
endif endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment