]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
Stop the ad-hoc games with -Wno-maybe-initialized
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 May 2020 20:57:10 +0000 (13:57 -0700)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Mon, 22 Jun 2020 20:21:58 +0000 (17:21 -0300)
commit205042bc171b887bf3fafb4df1e9bf11d09e204c
tree9d5ceface3b5e384055546dee4bd53205dde2b58
parent91cb21722879b59d709e411243b451438429db2f
Stop the ad-hoc games with -Wno-maybe-initialized

BugLink: https://bugs.launchpad.net/bugs/1879759
commit 78a5255ffb6a1af189a83e493d916ba1c54d8c75 upstream.

We have some rather random rules about when we accept the
"maybe-initialized" warnings, and when we don't.

For example, we consider it unreliable for gcc versions < 4.9, but also
if -O3 is enabled, or if optimizing for size.  And then various kernel
config options disabled it, because they know that they trigger that
warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).

And now gcc-10 seems to be introducing a lot of those warnings too, so
it falls under the same heading as 4.9 did.

At the same time, we have a very straightforward way to _enable_ that
warning when wanted: use "W=2" to enable more warnings.

So stop playing these ad-hoc games, and just disable that warning by
default, with the known and straight-forward "if you want to work on the
extra compiler warnings, use W=123".

Would it be great to have code that is always so obvious that it never
confuses the compiler whether a variable is used initialized or not?
Yes, it would.  In a perfect world, the compilers would be smarter, and
our source code would be simpler.

That's currently not the world we live in, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Makefile
init/Kconfig
kernel/trace/Kconfig