summaryrefslogtreecommitdiff
path: root/kconfig/symbol.c
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2020-12-09 08:24:45 (GMT)
committerChris Packham <judge.packham@gmail.com>2021-02-02 07:06:32 (GMT)
commitbbc4db133746d49893c3c9b70ef710747df27441 (patch)
tree6bd2bd5cc2970f7c896841939ce834754f678c3f /kconfig/symbol.c
parent689dc60f212db105243b60290480f29475578e0d (diff)
kconfig: Sync with upstream v4.18
This commit introduces the following upstream changes: 73d1c580f92b kconfig: loop boundary condition fix ecd53ac2f2c6 kconfig: handle P_SYMBOL in print_symbol() b2d00d7c61c8 kconfig: fix line numbers for if-entries in menu tree 8593080c0fcf kconfig: fix localmodconfig 2ae89c7a82ea kconfig: Avoid format overflow warning from GCC 8.1 bb6d83dde191 kbuild: Move last word of nconfig help to the previous line d6a0c8a1326b kconfig: Add testconfig into make help output 2bece88f89fa kconfig: test: add Kconfig macro language tests 915f64901eb3 kconfig: error out if a recursive variable references itself a702a6176e2f kconfig: add 'filename' and 'lineno' built-in variables 1d6272e6fe43 kconfig: add 'info', 'warning-if', and 'error-if' built-in functions 82bc8bd82e5c kconfig: expand lefthand side of assignment statement ed2a22f277c6 kconfig: support append assignment operator 1175c02506ff kconfig: support simply expanded variable 9ced3bddec08 kconfig: support user-defined function and recursively expanded variable 9de071536c87 kconfig: begin PARAM state only when seeing a command keyword 2fd5b09c201e kconfig: add 'shell' built-in function e298f3b49def kconfig: add built-in function support 137c0118a900 kconfig: make default prompt of mainmenu less specific 5b31a9746756 kconfig: remove sym_expand_string_value() 96d8e48da55a kconfig: remove string expansion for mainmenu after yyparse() bb222ceeb327 kconfig: remove string expansion in file_lookup() 104daea149c4 kconfig: reference environment variables directly and remove 'option env=' 694c49a7c01c kconfig: drop localization support 1c5af5cf9308 kconfig: refactor ncurses package checks for building mconf and nconf b464ef583dc7 kconfig: refactor GTK+ package checks for building gconf 0b669a5076fd kconfig: refactor Qt package checks for building qconf Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'kconfig/symbol.c')
-rw-r--r--kconfig/symbol.c109
1 files changed, 0 insertions, 109 deletions
diff --git a/kconfig/symbol.c b/kconfig/symbol.c
index f0b2e3b..7c9a88e 100644
--- a/kconfig/symbol.c
+++ b/kconfig/symbol.c
@@ -33,33 +33,6 @@ struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
-struct expr *sym_env_list;
-
-static void sym_add_default(struct symbol *sym, const char *def)
-{
- struct property *prop = prop_alloc(P_DEFAULT, sym);
-
- prop->expr = expr_alloc_symbol(sym_lookup(def, SYMBOL_CONST));
-}
-
-void sym_init(void)
-{
- struct symbol *sym;
- struct utsname uts;
- static bool inited = false;
-
- if (inited)
- return;
- inited = true;
-
- uname(&uts);
-
- sym = sym_lookup("UNAME_RELEASE", 0);
- sym->type = S_STRING;
- sym->flags |= SYMBOL_AUTO;
- sym_add_default(sym, uts.release);
-}
-
enum symbol_type sym_get_type(struct symbol *sym)
{
enum symbol_type type = sym->type;
@@ -906,59 +879,6 @@ struct symbol *sym_find(const char *name)
return symbol;
}
-/*
- * Expand symbol's names embedded in the string given in argument. Symbols'
- * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
- * the empty string.
- */
-char *sym_expand_string_value(const char *in)
-{
- const char *src;
- char *res;
- size_t reslen;
-
- /*
- * Note: 'in' might come from a token that's about to be
- * freed, so make sure to always allocate a new string
- */
- reslen = strlen(in) + 1;
- res = xmalloc(reslen);
- res[0] = '\0';
-
- while ((src = strchr(in, '$'))) {
- char *p, name[SYMBOL_MAXLENGTH];
- const char *symval = "";
- struct symbol *sym;
- size_t newlen;
-
- strncat(res, in, src - in);
- src++;
-
- p = name;
- while (isalnum(*src) || *src == '_')
- *p++ = *src++;
- *p = '\0';
-
- sym = sym_find(name);
- if (sym != NULL) {
- sym_calc_value(sym);
- symval = sym_get_string_value(sym);
- }
-
- newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
- if (newlen > reslen) {
- reslen = newlen;
- res = xrealloc(res, reslen);
- }
-
- strcat(res, symval);
- in = src;
- }
- strcat(res, in);
-
- return res;
-}
-
const char *sym_escape_string_value(const char *in)
{
const char *p;
@@ -1401,32 +1321,3 @@ const char *prop_get_type_name(enum prop_type type)
}
return "unknown";
}
-
-static void prop_add_env(const char *env)
-{
- struct symbol *sym, *sym2;
- struct property *prop;
- char *p;
-
- sym = current_entry->sym;
- sym->flags |= SYMBOL_AUTO;
- for_all_properties(sym, prop, P_ENV) {
- sym2 = prop_get_symbol(prop);
- if (strcmp(sym2->name, env))
- menu_warn(current_entry, "redefining environment symbol from %s",
- sym2->name);
- return;
- }
-
- prop = prop_alloc(P_ENV, sym);
- prop->expr = expr_alloc_symbol(sym_lookup(env, SYMBOL_CONST));
-
- sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
- sym_env_list->right.sym = sym;
-
- p = getenv(env);
- if (p)
- sym_add_default(sym, p);
- else
- menu_warn(current_entry, "environment variable %s undefined", env);
-}