Kbuild: allow subdirectories to override W= flags

Some subsystems have addressed all warnings of the W=1 level already,
so it makes sense to have a way to enable them per directory regardless
of the command line options.

Move the logic to identify the warning level to Makefile.lib, accumulating
the per-directory flags in $(KBUILD_EXTRA_WARN) so that each directory
can enable additional levels on top of the initial W= variable and its
parent directory settings.

This reverts part of 64a91907c896 ("kbuild: refactor
scripts/Makefile.extrawarn"), once more using separate variables
KBUILD_WARN_{W1,W2,W3} and KBUILD_WARN_{N1,N2,N3} to enable (W) or
disable (N) individual options in the correct order based on the current
settings. One downside is that this requires checking all the possible
options for the current compiler, which adds a bit of time to the
kernel build.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 files changed