https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90043
Bug ID: 90043
Summary: Turn on -Winit-self by default for -Wuninitialized
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
[ Spinoff bug of PR18017 comment 6. This is an issue that has been debated in
several existing PRs, but I'm filing it here since AFAIK there's not a single
PR with a summary specifying this specific issue. ]
-Winit-self is a warning separate from -Wuninitialized, because there's an
idiom where the init-self pattern is used to silence specific Wuninitialized
warnings, in which case you'd want the -Wuninitialized and -Wno-init-self
combination.
Furthermore, -Winit-self is only active when specified explicitly. In other
words, by default we cater for the "init-self pattern to silence specific
Wuninitialized warnings" scenario.
The proposal is to have -Wuninitialized imply -Winit-self, reversing the
default assumption.
In the new situation, if people want to use the init-self pattern to silence
specific Wuninitialized warnings, they would have to specify -Wno-init-self
explicitly.