public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: WERROR unmet symbol dependency
@ 2023-11-22  3:47 Sergey Senozhatsky
  2023-11-28  5:34 ` Sergey Senozhatsky
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Senozhatsky @ 2023-11-22  3:47 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Patrick Georgi, linux-kbuild, linux-kernel, Sergey Senozhatsky,
	Stefan Reinauer

When KCONFIG_WERROR env variable is set treat unmet direct
symbol dependency as a terminal condition (error).

Suggested-by: Stefan Reinauer <reinauer@google.com>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 scripts/kconfig/symbol.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index a76925b46ce6..34fc66e075b7 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -37,6 +37,7 @@ static struct symbol symbol_empty = {
 
 struct symbol *modules_sym;
 static tristate modules_val;
+static int sym_warnings;
 
 enum symbol_type sym_get_type(struct symbol *sym)
 {
@@ -317,12 +318,14 @@ static void sym_warn_unmet_dep(struct symbol *sym)
 			       "  Selected by [m]:\n");
 
 	fputs(str_get(&gs), stderr);
+	sym_warnings++;
 }
 
 void sym_calc_value(struct symbol *sym)
 {
 	struct symbol_value newval, oldval;
 	struct property *prop;
+	const char *werror;
 	struct expr *e;
 
 	if (!sym)
@@ -338,8 +341,9 @@ void sym_calc_value(struct symbol *sym)
 		sym_calc_value(prop_get_symbol(prop));
 	}
 
+	werror = getenv("KCONFIG_WERROR");
+	sym_warnings = 0;
 	sym->flags |= SYMBOL_VALID;
-
 	oldval = sym->curr;
 
 	switch (sym->type) {
@@ -430,6 +434,9 @@ void sym_calc_value(struct symbol *sym)
 		;
 	}
 
+	if (sym_warnings && werror)
+		exit(1);
+
 	sym->curr = newval;
 	if (sym_is_choice(sym) && newval.tri == yes)
 		sym->curr.val = sym_calc_choice(sym);
-- 
2.43.0.rc1.413.gea7ed67945-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-02  1:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22  3:47 [PATCH] kconfig: WERROR unmet symbol dependency Sergey Senozhatsky
2023-11-28  5:34 ` Sergey Senozhatsky
2023-11-28 14:19   ` Masahiro Yamada
2023-11-29  4:13     ` Sergey Senozhatsky
2023-11-30 15:42       ` Masahiro Yamada
2023-12-22  2:57         ` Sergey Senozhatsky
2023-12-29 13:41           ` Masahiro Yamada
2024-01-02  1:18             ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox