diff options
author | Marco Elver <elver@google.com> | 2021-09-07 23:12:08 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-07 18:47:04 -0700 |
commit | b339ec9c229aaf399296a120d7be0e34fbc355ca (patch) | |
tree | d20c9b2a86e8437ae3b8bcb85ee69adaa706eadd /init/Kconfig | |
parent | 626bf91a292e2035af5b9d9cce35c5c138dfe06d (diff) | |
download | linux-stable-b339ec9c229aaf399296a120d7be0e34fbc355ca.tar.gz linux-stable-b339ec9c229aaf399296a120d7be0e34fbc355ca.tar.bz2 linux-stable-b339ec9c229aaf399296a120d7be0e34fbc355ca.zip |
kbuild: Only default to -Werror if COMPILE_TEST
The cross-product of the kernel's supported toolchains, architectures,
and configuration options is large. So large, that it's generally
accepted to be infeasible to enumerate and build+test them all
(many compile-testers rely on randomly generated configs).
Without the possibility to enumerate all possible combinations of
toolchains, architectures, and configuration options, it is inevitable
that compiler warnings in this space exist.
With -Werror, this means that an innumerable set of kernels are now
broken, yet had been perfectly usable before (confused compilers, code
with warnings unused, or luck).
Distributors will necessarily pick a point in the toolchain X arch X
config space, and if unlucky, will have a broken build. Granted, those
will likely disable CONFIG_WERROR and move on.
The kernel's default configuration is unlikely to be suitable for all
users, but it's inappropriate to force many users to set CONFIG_WERROR=n.
This also holds for CI systems which are focused on runtime testing,
where the odd warning in some subsystem will disrupt testing of the rest
of the kernel. Many of those runtime-focused CI systems run tests or
fuzz the kernel using runtime debugging tools. Runtime testing of
different subsystems can proceed in parallel, and potentially uncover
serious bugs; halting runtime testing of the entire kernel because of
the odd warning (now error) in a subsystem or driver is simply
inappropriate.
Therefore, runtime-focused CI systems will likely choose CONFIG_WERROR=n
as well.
The appropriate usecase for -Werror is therefore compile-test focused
builds (often done by developers or CI systems).
Reflect this in the Kconfig option by making the default value of WERROR
match COMPILE_TEST.
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Reviwed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/Kconfig')
-rw-r--r-- | init/Kconfig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/init/Kconfig b/init/Kconfig index 8cb97f141b70..11f8a845f259 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -139,7 +139,7 @@ config COMPILE_TEST config WERROR bool "Compile the kernel with warnings as errors" - default y + default COMPILE_TEST help A kernel build should not cause any compiler warnings, and this enables the '-Werror' flag to enforce that rule by default. |