1 From: Sergey Senozhatsky <senozhatsky@chromium.org>
2 To: Masahiro Yamada <masahiroy@kernel.org>
3 Cc: Patrick Georgi <pgeorgi@google.com>, linux-kbuild@vger.kernel.org,
4 linux-kernel@vger.kernel.org,
5 Sergey Senozhatsky <senozhatsky@chromium.org>,
6 Stefan Reinauer <reinauer@google.com>
7 Subject: [PATCH] kconfig: WERROR unmet symbol dependency
8 Date: Wed, 22 Nov 2023 12:47:45 +0900
9 Message-ID: <20231122034753.1446513-1-senozhatsky@chromium.org>
11 Content-Transfer-Encoding: 8bit
12 List-ID: <linux-kernel.vger.kernel.org>
13 X-Mailing-List: linux-kernel@vger.kernel.org
15 When KCONFIG_WERROR env variable is set treat unmet direct
16 symbol dependency as a terminal condition (error).
18 Suggested-by: Stefan Reinauer <reinauer@google.com>
19 Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
21 scripts/kconfig/symbol.c | 9 ++++++++-
22 1 file changed, 8 insertions(+), 1 deletion(-)
24 Index: kconfig/symbol.c
25 ===================================================================
26 --- kconfig.orig/symbol.c
28 @@ -37,6 +37,7 @@ static struct symbol symbol_empty = {
30 struct symbol *modules_sym;
31 static tristate modules_val;
32 +static int sym_warnings;
34 enum symbol_type sym_get_type(struct symbol *sym)
36 @@ -317,12 +318,14 @@ static void sym_warn_unmet_dep(struct sy
37 " Selected by [m]:\n");
39 fputs(str_get(&gs), stderr);
43 void sym_calc_value(struct symbol *sym)
45 struct symbol_value newval, oldval;
46 struct property *prop;
51 @@ -338,8 +341,9 @@ void sym_calc_value(struct symbol *sym)
52 sym_calc_value(prop_get_symbol(prop));
55 + werror = getenv("KCONFIG_WERROR");
57 sym->flags |= SYMBOL_VALID;
62 @@ -430,6 +434,9 @@ void sym_calc_value(struct symbol *sym)
66 + if (sym_warnings && werror)
70 if (sym_is_choice(sym) && newval.tri == yes)
71 sym->curr.val = sym_calc_choice(sym);