Skip to content

Enable -Wuninitialized #381

@nathanchance

Description

@nathanchance

29b00e6 would have been caught with Clang in its default configuration (and not by GCC due to a bug), as pointed out in this thread: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/

However, -Wuninitialized also disables -Wsometimes-uninitialized so this was missed by both compilers :(

I am going to test the following diff then send it along right away if there are no additional warnings:

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 768306add591..f4332981ea85 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
 KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
 KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
+KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
 endif
 endif

Side note, looks like this might be a good time to tell Linus about the KernelCI work that is going on: https://lore.kernel.org/lkml/CAHk-=wggjLsi-1BmDHqWAJPzBvTD_-MQNo5qQ9WCuncnyWPROg@mail.gmail.com/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions