Skip to contentSkip to conversation

Makefile.extrawarn: Move -Wcast-function-type-strict to W=1

PATCH Applied Sami Tolvanen 2 participants 2 messages Sep 30, 2022 – Oct 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.extrawarn: Move -Wcast-function-type-strict to W=1

We enable -Wcast-function-type globally in the kernel to warn about mismatching types in function pointer casts. Compilers currently warn only about ABI incompability with this flag, but Clang 16 will enable a stricter version of the check by default that checks for an exact type match. This will be very noisy in the kernel, so disable -Wcast-function-type-strict without W=1 until the new warnings have been addressed.

---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)
scripts/Makefile.extrawarn +1 -0
index 6ae482158bc4..52bd7df84fd6 100644
@@ -64,6 +64,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
 KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
 KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
+KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
 endif
 
 endif

base-commit: 7bc6e90d7aa4170039abe80b9f4e8c8e4eb35091

Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Applied
#1 lore raw
Quoted 9 lines · Sami Tolvanen

We enable -Wcast-function-type globally in the kernel to warn about mismatching types in function pointer casts. Compilers currently warn only about ABI incompability with this flag, but Clang 16 will enable a stricter version of the check by default that checks for an exact type match. This will be very noisy in the kernel, so disable -Wcast-function-type-strict without W=1 until the new warnings have been addressed.

[...]

Applied to for-next/hardening, thanks!

[1/1] Makefile.extrawarn: Move -Wcast-function-type-strict to W=1

      https://git.kernel.org/kees/c/2120635108b3
Signature · 1 line
Kees Cook