[PATCH 0/2] Deal with clang's -Wdefault-const-init-unsafe

Nathan Chancellor posted 2 patches 9 months, 1 week ago
include/linux/typecheck.h  | 4 ++--
scripts/Makefile.extrawarn | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
[PATCH 0/2] Deal with clang's -Wdefault-const-init-unsafe
Posted by Nathan Chancellor 9 months, 1 week ago
A new on by default warning in clang aims to flag cases where a const
variable or field is not initialized and has no default value (i.e., not
static or thread local). The field version of the warning triggers in
several places within the kernel that are not problematic so it is
disabled in the first patch. The variable version of the warning only
triggers in one place, the typecheck() macro, so I opted to silence it
in that one place to keep it enabled until it can be proved to be
problematic enough to disable it.

---
Nathan Chancellor (2):
      kbuild: Disable -Wdefault-const-init-field-unsafe
      include/linux/typecheck.h: Zero initialize dummy variables

 include/linux/typecheck.h  | 4 ++--
 scripts/Makefile.extrawarn | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
---
base-commit: ebd297a2affadb6f6f4d2e5d975c1eda18ac762d
change-id: 20250430-default-const-init-clang-b6e21b8d03b6

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>