]> git.baikalelectronics.ru Git - kernel.git/commit
Makefile.extrawarn: re-enable -Wformat for clang; take 2
authorNick Desaulniers <ndesaulniers@google.com>
Thu, 1 Sep 2022 17:59:13 +0000 (10:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 4 Sep 2022 18:15:50 +0000 (11:15 -0700)
commit43bc04d4750122c631cd80f2eef615fedde3ec78
tree64b21a1f600a35a36dc1a1ba78bac0c89a5c8dd4
parentbe9070b94a7f4aa619781667f86c306ac0bcea36
Makefile.extrawarn: re-enable -Wformat for clang; take 2

-Wformat was recently re-enabled for builds with clang, then quickly
re-disabled, due to concerns stemming from the frequency of default
argument promotion related warning instances.

commit e4c420f97dd0 ("Makefile.extrawarn: re-enable -Wformat for clang")
commit e7c0bfd5eb05 ("Revert "Makefile.extrawarn: re-enable -Wformat for clang"")

ISO WG14 has ratified N2562 to address default argument promotion
explicitly for printf, as part of the upcoming ISO C2X standard.

The behavior of clang was changed in clang-16 to not warn for the cited
cases in all language modes.

Add a version check, so that users of clang-16 now get the full effect
of -Wformat. For older clang versions, re-enable flags under the
-Wformat group that way users still get some useful checks related to
format strings, without noisy default argument promotion warnings. I
intentionally omitted -Wformat-y2k and -Wformat-security from being
re-enabled, which are also part of -Wformat in clang-16.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Link: https://github.com/llvm/llvm-project/issues/57102
Link: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2562.pdf
Suggested-by: Justin Stitt <jstitt007@gmail.com>
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Youngmin Nam <youngmin.nam@samsung.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/Makefile.extrawarn