aboutsummaryrefslogtreecommitdiff
path: root/util/kconfig/symbol.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@coreboot.org>2024-03-13 13:01:21 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-04-03 12:28:04 +0000
commit7761237dfe0c509fa4cae255b20fa4b1278cbca1 (patch)
tree949e8eafd32fd4bfb2a518f7cce4344ddf3c25e3 /util/kconfig/symbol.c
parent96499840aa3f5376ae8cfa1cefb6fd98800019a9 (diff)
util/kconfig: Uprev to Linux 6.8's kconfig
Linux kconfig has its own implementation of KCONFIG_WERROR now, so use that. This reduces our patch count by 2. Change-Id: I4f5f1f552e96f8ef7a4c5c0ab2ab7e2b6d798ceb Signed-off-by: Patrick Georgi <patrick@georgi.software> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81223 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/kconfig/symbol.c')
-rw-r--r--util/kconfig/symbol.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/util/kconfig/symbol.c b/util/kconfig/symbol.c
index 77de8ee347..3afe5be2d4 100644
--- a/util/kconfig/symbol.c
+++ b/util/kconfig/symbol.c
@@ -29,12 +29,6 @@ struct symbol symbol_no = {
.flags = SYMBOL_CONST|SYMBOL_VALID,
};
-static struct symbol symbol_empty = {
- .name = "",
- .curr = { "", no },
- .flags = SYMBOL_VALID,
-};
-
struct symbol *modules_sym;
static tristate modules_val;
static int sym_warnings;
@@ -321,11 +315,17 @@ static void sym_warn_unmet_dep(struct symbol *sym)
sym_warnings++;
}
+bool sym_dep_errors(void)
+{
+ if (sym_warnings)
+ return getenv("KCONFIG_WERROR");
+ return false;
+}
+
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
struct property *prop;
- const char *werror;
struct expr *e;
if (!sym)
@@ -341,20 +341,25 @@ 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;
+ newval.tri = no;
+
switch (sym->type) {
case S_INT:
+ newval.val = "0";
+ break;
case S_HEX:
+ newval.val = "0x0";
+ break;
case S_STRING:
- newval = symbol_empty.curr;
+ newval.val = "";
break;
case S_BOOLEAN:
case S_TRISTATE:
- newval = symbol_no.curr;
+ newval.val = "n";
break;
default:
sym->curr.val = sym->name;
@@ -434,9 +439,6 @@ 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);
@@ -704,13 +706,12 @@ const char *sym_get_string_default(struct symbol *sym)
{
struct property *prop;
struct symbol *ds;
- const char *str;
+ const char *str = "";
tristate val;
sym_calc_visibility(sym);
sym_calc_value(modules_sym);
val = symbol_no.curr.tri;
- str = symbol_empty.curr.val;
/* If symbol has a default value look it up */
prop = sym_get_default_prop(sym);
@@ -760,14 +761,17 @@ const char *sym_get_string_default(struct symbol *sym)
case yes: return "y";
}
case S_INT:
+ if (!str[0])
+ str = "0";
+ break;
case S_HEX:
- return str;
- case S_STRING:
- return str;
- case S_UNKNOWN:
+ if (!str[0])
+ str = "0x0";
+ break;
+ default:
break;
}
- return "";
+ return str;
}
const char *sym_get_string_value(struct symbol *sym)