summaryrefslogtreecommitdiff
path: root/util/kconfig/patches
diff options
context:
space:
mode:
Diffstat (limited to 'util/kconfig/patches')
-rw-r--r--util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch39
-rw-r--r--util/kconfig/patches/0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch6
-rw-r--r--util/kconfig/patches/0005-util-kconfig-Ignore-extra-symbols-in-configs-instead.patch37
-rw-r--r--util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch236
-rw-r--r--util/kconfig/patches/0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch8
-rw-r--r--util/kconfig/patches/0014-util-kconfig-Move-Kconfig-deps-back-into-build-confi.patch2
-rw-r--r--util/kconfig/patches/series1
7 files changed, 74 insertions, 255 deletions
diff --git a/util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch b/util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch
index 9e50eb39a1..4b1e5bb71e 100644
--- a/util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch
+++ b/util/kconfig/patches/0001-Kconfig-Add-KCONFIG_STRICT-mode.patch
@@ -1,43 +1,18 @@
-From c822f47921feb53b97f48f3aa8d1e843f5099c63 Mon Sep 17 00:00:00 2001
-From: Stefan Reinauer <stefan.reinauer@coreboot.org>
-Date: Fri, 17 Jul 2015 17:26:48 -0700
-Subject: [PATCH] Kconfig: Add KCONFIG_STRICT mode
-
-This is basically a -Werror mode for Kconfig. When exporting
-KCONFIG_STRICT in the Makefile, warnings in Kconfig will produce
-errors instead.
-
-This will make it easier to spot unclean Kconfig files, settings
-and dependencies.
-
-Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
----
- util/kconfig/confdata.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
+Make KCONFIG_WERROR more verbose.
Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
-@@ -437,6 +437,7 @@ load:
- if (def == S_DEF_USER) {
- sym = sym_find(line + 2 + strlen(CONFIG_));
- if (!sym) {
-+ conf_warning("trying to assign non-existent symbol %s", line + strlen(CONFIG_));
- conf_set_changed(true);
- continue;
- }
-@@ -519,6 +520,13 @@ load:
- }
+@@ -533,8 +533,10 @@ load:
free(line);
fclose(in);
-+
-+ name = getenv("KCONFIG_STRICT");
-+ if (name && *name && conf_warnings) {
+
+- if (conf_warnings && werror)
++ if (conf_warnings && werror) {
+ fprintf(stderr, "\nERROR: %d warnings encountered, and warnings are errors.\n\n", conf_warnings);
-+ return 1;
+ exit(1);
+ }
-+
+
return 0;
}
-
diff --git a/util/kconfig/patches/0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch b/util/kconfig/patches/0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch
index c1ce24970c..3ad9f1ec98 100644
--- a/util/kconfig/patches/0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch
+++ b/util/kconfig/patches/0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch
@@ -40,7 +40,7 @@ Index: kconfig/confdata.c
static void conf_default_message_callback(const char *s)
{
printf("#\n# ");
-@@ -447,7 +457,7 @@ load:
+@@ -454,7 +464,7 @@ load:
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
@@ -49,7 +49,7 @@ Index: kconfig/confdata.c
}
switch (sym->type) {
case S_BOOLEAN:
-@@ -486,7 +496,7 @@ load:
+@@ -498,7 +508,7 @@ load:
}
if (sym->flags & def_flags) {
@@ -58,7 +58,7 @@ Index: kconfig/confdata.c
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
-@@ -511,7 +521,7 @@ load:
+@@ -523,7 +533,7 @@ load:
break;
case yes:
if (cs->def[def].tri != no)
diff --git a/util/kconfig/patches/0005-util-kconfig-Ignore-extra-symbols-in-configs-instead.patch b/util/kconfig/patches/0005-util-kconfig-Ignore-extra-symbols-in-configs-instead.patch
deleted file mode 100644
index c05e4a64bf..0000000000
--- a/util/kconfig/patches/0005-util-kconfig-Ignore-extra-symbols-in-configs-instead.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 2796443d5a2194400e56e6762e0f748ed0f0470c Mon Sep 17 00:00:00 2001
-From: Martin Roth <martinroth@google.com>
-Date: Wed, 10 Feb 2016 16:06:00 -0700
-Subject: [PATCH] util/kconfig: Ignore extra symbols in configs instead of
- failing
-
-When updating an old .config file that has a symbol that has been
-removed from the current Kconfig tree, kconfig will generate a warning
-and fail to save the updated file. This is incredibly annoying, and
-not the goal when trying to eliminate Kconfig warnings.
-
-Instead of generating a warning, just print a message that it's being
-ignored. This will remove the offending symbol, while allowing the
-updated config file to be saved.
-
-Split the change from 1 line to 3 lines to keep it at 80 characters.
-
-Signed-off-by: Martin Roth <martinroth@google.com>
----
- util/kconfig/confdata.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-Index: kconfig/confdata.c
-===================================================================
---- kconfig.orig/confdata.c
-+++ kconfig/confdata.c
-@@ -447,7 +447,9 @@ load:
- if (def == S_DEF_USER) {
- sym = sym_find(line + 2 + strlen(CONFIG_));
- if (!sym) {
-- conf_warning("trying to assign non-existent symbol %s", line + strlen(CONFIG_));
-+ conf_message(
-+ "ignoring nonexistent symbol %s",
-+ line + 2 + strlen(CONFIG_));
- conf_set_changed(true);
- continue;
- }
diff --git a/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch b/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch
index 8677be4936..f98729e85b 100644
--- a/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch
+++ b/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch
@@ -1,189 +1,71 @@
-From af6c23be63d14860c8c1f0d9fcbc020f7c11d84d Mon Sep 17 00:00:00 2001
-From: Stefan Reinauer <reinauer@chromium.org>
-Date: Thu, 20 Aug 2015 11:19:34 -0700
-Subject: [PATCH] kconfig: Allow KCONFIG_STRICT outside of confdata.c
+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
-To catch dependency errors in symbol.c (such as the ones
-fixed by I51b4ee326f082c6a656a813ee5772e9c34f5c343) we need
-to check for global kconfig warnings before saving config
-files.
+When KCONFIG_WERROR env variable is set treat unmet direct
+symbol dependency as a terminal condition (error).
-This patch will produce errors for wrong dependencies and
-add catching of errors to conf, nconf and mconf. Sorry,
-gconf users, you will have to wait.
-
-Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
+Suggested-by: Stefan Reinauer <reinauer@google.com>
+Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
- util/kconfig/conf.c | 10 ++++++++++
- util/kconfig/confdata.c | 6 +-----
- util/kconfig/lkc.h | 3 +++
- util/kconfig/mconf.c | 10 ++++++++++
- util/kconfig/nconf.c | 13 +++++++++++++
- util/kconfig/qconf.cc | 2 ++
- util/kconfig/symbol.c | 1 +
- 7 files changed, 40 insertions(+), 5 deletions(-)
+ scripts/kconfig/symbol.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
-Index: kconfig/conf.c
-===================================================================
---- kconfig.orig/conf.c
-+++ kconfig/conf.c
-@@ -16,6 +16,8 @@
-
- #include "lkc.h"
-
-+int kconfig_warnings = 0;
-+
- static void conf(struct menu *menu);
- static void check_conf(struct menu *menu);
-
-@@ -720,6 +722,7 @@ int main(int ac, char **av)
- const char *progname = av[0];
- int opt;
- const char *name, *defconfig_file = NULL /* gcc uninit */;
-+ char *env;
- int no_conf_write = 0;
-
- tty_stdio = isatty(0) && isatty(1);
-@@ -827,6 +830,13 @@ int main(int ac, char **av)
- break;
- }
-
-+ env = getenv("KCONFIG_STRICT");
-+ if (env && *env && kconfig_warnings) {
-+ fprintf(stderr, "\n*** ERROR: %d warnings encountered, and "
-+ "warnings are errors.\n\n", kconfig_warnings);
-+ exit(1);
-+ }
-+
- if (sync_kconfig) {
- name = getenv("KCONFIG_NOSILENTUPDATE");
- if (name && *name) {
-Index: kconfig/confdata.c
-===================================================================
---- kconfig.orig/confdata.c
-+++ kconfig/confdata.c
-@@ -537,11 +537,7 @@ load:
- free(line);
- fclose(in);
-
-- name = getenv("KCONFIG_STRICT");
-- if (name && *name && conf_warnings) {
-- fprintf(stderr, "\nERROR: %d warnings encountered, and warnings are errors.\n\n", conf_warnings);
-- return 1;
-- }
-+ kconfig_warnings += conf_warnings;
-
- return 0;
- }
-Index: kconfig/lkc.h
-===================================================================
---- kconfig.orig/lkc.h
-+++ kconfig/lkc.h
-@@ -39,6 +39,9 @@ void zconf_nextfile(const char *name);
- int zconf_lineno(void);
- const char *zconf_curname(void);
-
-+/* conf.c */
-+extern int kconfig_warnings;
-+
- /* confdata.c */
- const char *conf_get_configname(void);
- void set_all_choice_values(struct symbol *csym);
-Index: kconfig/mconf.c
-===================================================================
---- kconfig.orig/mconf.c
-+++ kconfig/mconf.c
-@@ -24,6 +24,8 @@
-
- #define JUMP_NB 9
-
-+int kconfig_warnings = 0;
-+
- static const char mconf_readme[] =
- "Overview\n"
- "--------\n"
-@@ -943,6 +945,7 @@ static void conf_message_callback(const
- static int handle_exit(void)
- {
- int res;
-+ char *env;
-
- save_and_exit = 1;
- reset_subtitle();
-@@ -957,6 +960,13 @@ static int handle_exit(void)
-
- end_dialog(saved_x, saved_y);
-
-+ env = getenv("KCONFIG_STRICT");
-+ if (env && *env && kconfig_warnings) {
-+ fprintf(stderr, "\n*** ERROR: %d warnings encountered, and "
-+ "warnings are errors.\n\n", kconfig_warnings);
-+ res = 2;
-+ }
-+
- switch (res) {
- case 0:
- if (conf_write(filename)) {
-Index: kconfig/nconf.c
-===================================================================
---- kconfig.orig/nconf.c
-+++ kconfig/nconf.c
-@@ -15,6 +15,8 @@
- #include "nconf.h"
- #include <ctype.h>
-
-+int kconfig_warnings = 0;
-+
- static const char nconf_global_help[] =
- "Help windows\n"
- "------------\n"
-@@ -645,6 +647,8 @@ static void set_config_filename(const ch
- static int do_exit(void)
- {
- int res;
-+ char *env;
-+
- if (!conf_get_changed()) {
- global_exit = 1;
- return 0;
-@@ -660,6 +664,15 @@ static int do_exit(void)
- return -1;
- }
-
-+ env = getenv("KCONFIG_STRICT");
-+ if (env && *env && kconfig_warnings) {
-+ btn_dialog(main_window,
-+ "\nWarnings encountered, and warnings are errors.\n\n",
-+ 1,
-+ "<OK>");
-+ res = 2;
-+ }
-+
- /* if we got here, the user really wants to exit */
- switch (res) {
- case 0:
-Index: kconfig/qconf.cc
-===================================================================
---- kconfig.orig/qconf.cc
-+++ kconfig/qconf.cc
-@@ -26,6 +26,8 @@
- #include "images.h"
-
-
-+int kconfig_warnings = 0;
-+
- static QApplication *configApp;
- static ConfigSettings *configSettings;
-
Index: kconfig/symbol.c
===================================================================
--- kconfig.orig/symbol.c
+++ kconfig/symbol.c
-@@ -319,6 +319,7 @@ static void sym_warn_unmet_dep(struct sy
+@@ -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
" Selected by [m]:\n");
-
+
fputs(str_get(&gs), stderr);
-+ kconfig_warnings++;
++ 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)
+@@ -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);
diff --git a/util/kconfig/patches/0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch b/util/kconfig/patches/0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch
index bfb89f94c2..101bc695a4 100644
--- a/util/kconfig/patches/0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch
+++ b/util/kconfig/patches/0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch
@@ -14,7 +14,7 @@ Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
-@@ -725,7 +725,12 @@ static void print_symbol_for_dotconfig(F
+@@ -738,7 +738,12 @@ static void print_symbol_for_dotconfig(F
static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
{
@@ -28,7 +28,7 @@ Index: kconfig/confdata.c
}
void print_symbol_for_listconfig(struct symbol *sym)
-@@ -750,6 +755,10 @@ static void print_symbol_for_c(FILE *fp,
+@@ -763,6 +768,10 @@ static void print_symbol_for_c(FILE *fp,
case S_TRISTATE:
switch (*val) {
case 'n':
@@ -39,7 +39,7 @@ Index: kconfig/confdata.c
return;
case 'm':
sym_suffix = "_MODULE";
-@@ -761,6 +770,12 @@ static void print_symbol_for_c(FILE *fp,
+@@ -774,6 +783,12 @@ static void print_symbol_for_c(FILE *fp,
case S_HEX:
if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X'))
val_prefix = "0x";
@@ -52,7 +52,7 @@ Index: kconfig/confdata.c
break;
case S_STRING:
escaped = escape_string_value(val);
-@@ -1177,8 +1192,9 @@ static int __conf_write_autoconf(const c
+@@ -1190,8 +1205,9 @@ static int __conf_write_autoconf(const c
conf_write_heading(file, comment_style);
diff --git a/util/kconfig/patches/0014-util-kconfig-Move-Kconfig-deps-back-into-build-confi.patch b/util/kconfig/patches/0014-util-kconfig-Move-Kconfig-deps-back-into-build-confi.patch
index 09079cde9f..54a79c33ce 100644
--- a/util/kconfig/patches/0014-util-kconfig-Move-Kconfig-deps-back-into-build-confi.patch
+++ b/util/kconfig/patches/0014-util-kconfig-Move-Kconfig-deps-back-into-build-confi.patch
@@ -35,7 +35,7 @@ Index: kconfig/confdata.c
static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
{
char *p2;
-@@ -1093,19 +1100,19 @@ static int conf_write_autoconf_cmd(const
+@@ -1106,19 +1113,19 @@ static int conf_write_autoconf_cmd(const
static int conf_touch_deps(void)
{
diff --git a/util/kconfig/patches/series b/util/kconfig/patches/series
index 655c493868..48c7289538 100644
--- a/util/kconfig/patches/series
+++ b/util/kconfig/patches/series
@@ -2,7 +2,6 @@
0002-Kconfig-Change-symbol-override-from-warning-to-notic.patch
0003-util-kconfig-conf.c-Fix-newline-in-error-printf.patch
0004-src-util-Use-NULL-instead-of-0-for-pointer.patch
-0005-util-kconfig-Ignore-extra-symbols-in-configs-instead.patch
0006-util-kconfig-Set-parameter-of-mkdir-to-only-one-for-.patch
0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch
0008-kconfig-Add-wildcard-support-for-source.patch