]> git.baikalelectronics.ru Git - kernel.git/commit
kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS
authorNathan Chancellor <nathan@kernel.org>
Thu, 16 Sep 2021 18:40:17 +0000 (11:40 -0700)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 19 Sep 2021 01:55:18 +0000 (10:55 +0900)
commit5d88f45269d93918f853728a02d851902b1a4462
tree64d1b995007dfb9175c8f369519bcaa971c557c3
parent26a552f27a91d5f9d94eafb0e43a0a2fc3724048
kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS

Similar to commit 8c585b8df2d2 ("kbuild: Add
-Werror=unknown-warning-option to CLANG_FLAGS").

Clang ignores certain GCC flags that it has not implemented, only
emitting a warning:

$ echo | clang -fsyntax-only -falign-jumps -x c -
clang-14: warning: optimization flag '-falign-jumps' is not supported
[-Wignored-optimization-argument]

When one of these flags gets added to KBUILD_CFLAGS unconditionally, all
subsequent cc-{disable-warning,option} calls fail because -Werror was
added to these invocations to turn the above warning and the equivalent
-W flag warning into errors.

To catch the presence of these flags earlier, turn
-Wignored-optimization-argument into an error so that the flags can
either be implemented or ignored via cc-option and there are no more
weird errors.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/Makefile.clang