From ce8c639a6c539534be14a540e7c3e9933d3a34ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Wed, 24 May 2023 09:46:45 +0200 Subject: [PATCH] kernel: introduce KERNEL_WERROR config option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In commit b2d1eb717b65 ("generic: 5.15: enable Werror by default for kernel compile") CONFIG_WERROR=y was enabled and all warnings/errors reported with GCC 12 were fixed. Keeping this in sync with past/future GCC versions is going to be uphill battle, so lets introduce new KERNEL_WERROR config option, enable it by default only for tested/known working combinations and on buildbots. References: #12687 Signed-off-by: Petr Å tetiar --- config/Config-kernel.in | 16 ++++++++++++++++ target/linux/generic/config-5.15 | 2 +- target/linux/generic/config-6.1 | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 7de0d17b5eaa..a770a9d79737 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1343,3 +1343,19 @@ config KERNEL_UBIFS_FS_SECURITY config KERNEL_JFFS2_FS_SECURITY bool "JFFS2 Security Labels" + +config KERNEL_WERROR + bool "Compile the kernel with warnings as errors" + default BUILDBOT + default y if GCC_USE_VERSION_12 + help + A kernel build should not cause any compiler warnings, and this + enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags + to enforce that rule by default. Certain warnings from other tools + such as the linker may be upgraded to errors with this option as + well. + + However, if you have a new (or very old) compiler or linker with odd + and unusual warnings, or you have some architecture with problems, + you may need to disable this config option in order to + successfully build the kernel. diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 251a6fbcc32f..a7308ede9d84 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -7472,7 +7472,7 @@ CONFIG_WATCHDOG_OPEN_TIMEOUT=0 # CONFIG_WD80x3 is not set # CONFIG_WDAT_WDT is not set # CONFIG_WDTPCI is not set -CONFIG_WERROR=y +# CONFIG_WERROR is not set # CONFIG_WEXT_CORE is not set # CONFIG_WEXT_PRIV is not set # CONFIG_WEXT_PROC is not set diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1 index 956738afe8e8..8bf9d4a3d856 100644 --- a/target/linux/generic/config-6.1 +++ b/target/linux/generic/config-6.1 @@ -7731,7 +7731,7 @@ CONFIG_WATCHDOG_OPEN_TIMEOUT=0 # CONFIG_WD80x3 is not set # CONFIG_WDAT_WDT is not set # CONFIG_WDTPCI is not set -CONFIG_WERROR=y +# CONFIG_WERROR is not set # CONFIG_WEXT_CORE is not set # CONFIG_WEXT_PRIV is not set # CONFIG_WEXT_PROC is not set -- 2.30.2