2023-11-20 19:49:29 +01:00
|
|
|
From: Sergey Senozhatsky <senozhatsky@chromium.org>
|
|
|
|
To: Masahiro Yamada <masahiroy@kernel.org>
|
|
|
|
Cc: Patrick Georgi <pgeorgi@google.com>, linux-kbuild@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org,
|
|
|
|
Sergey Senozhatsky <senozhatsky@chromium.org>,
|
|
|
|
Stefan Reinauer <reinauer@google.com>
|
|
|
|
Subject: [PATCH] kconfig: WERROR unmet symbol dependency
|
|
|
|
Date: Wed, 22 Nov 2023 12:47:45 +0900
|
|
|
|
Message-ID: <20231122034753.1446513-1-senozhatsky@chromium.org>
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
List-ID: <linux-kernel.vger.kernel.org>
|
|
|
|
X-Mailing-List: linux-kernel@vger.kernel.org
|
2019-11-22 16:55:58 +01:00
|
|
|
|
2023-11-20 19:49:29 +01:00
|
|
|
When KCONFIG_WERROR env variable is set treat unmet direct
|
|
|
|
symbol dependency as a terminal condition (error).
|
2019-11-22 16:55:58 +01:00
|
|
|
|
2023-11-20 19:49:29 +01:00
|
|
|
Suggested-by: Stefan Reinauer <reinauer@google.com>
|
|
|
|
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
|
2019-11-22 16:55:58 +01:00
|
|
|
---
|
2023-11-20 19:49:29 +01:00
|
|
|
scripts/kconfig/symbol.c | 9 ++++++++-
|
|
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
2019-11-22 16:55:58 +01:00
|
|
|
|
|
|
|
Index: kconfig/symbol.c
|
|
|
|
===================================================================
|
|
|
|
--- kconfig.orig/symbol.c
|
|
|
|
+++ kconfig/symbol.c
|
2023-11-20 19:49:29 +01:00
|
|
|
@@ -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)
|
|
|
|
{
|
|
|
|
@@ -319,12 +320,14 @@ static void sym_warn_unmet_dep(struct sy
|
2019-11-22 16:55:58 +01:00
|
|
|
" Selected by [m]:\n");
|
2023-11-20 19:49:29 +01:00
|
|
|
|
2019-11-22 16:55:58 +01:00
|
|
|
fputs(str_get(&gs), stderr);
|
2023-11-20 19:49:29 +01:00
|
|
|
+ sym_warnings++;
|
2019-11-22 16:55:58 +01:00
|
|
|
}
|
2023-11-20 19:49:29 +01:00
|
|
|
|
2019-11-22 16:55:58 +01:00
|
|
|
void sym_calc_value(struct symbol *sym)
|
2023-11-20 19:49:29 +01:00
|
|
|
{
|
|
|
|
struct symbol_value newval, oldval;
|
|
|
|
struct property *prop;
|
|
|
|
+ const char *werror;
|
|
|
|
struct expr *e;
|
|
|
|
|
|
|
|
if (!sym)
|
|
|
|
@@ -340,8 +343,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) {
|
|
|
|
@@ -432,6 +436,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);
|