author: Nathan Chancellor <nathan@kernel.org> 2021-09-16 11:40:17 -0700
committer: Masahiro Yamada <masahiroy@kernel.org> 2021-09-19 10:55:18 +0900
commit: 0664684e1ebd7875e120d0cecd525bac4805f8ed
parent: 7fa6a2746616c8de4c40b748c2bb0656e00624ff
Commit Summary:
Diffstat:
1 file changed, 5 insertions, 0 deletions
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 4cce8fd0779c..51fc23e2e9e5 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -29,7 +29,12 @@ CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
else
CLANG_FLAGS += -fintegrated-as
endif
+# By default, clang only warns when it encounters an unknown warning flag or
+# certain optimization flags it knows it has not implemented.
+# Make it behave more like gcc by erroring when these flags are encountered
+# so they can be implemented or wrapped in cc-option.
CLANG_FLAGS += -Werror=unknown-warning-option
+CLANG_FLAGS += -Werror=ignored-optimization-argument
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS