Commit 2aabbed6 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remove S_OTHER symbol type and correct dependency tracking

The S_OTHER type could be set only when conf_read_simple() is reading
include/config/auto.conf file.

For example, CONFIG_FOO=y exists in include/config/auto.conf but it is
missing from the currently parsed Kconfig files, sym_lookup() allocates
a new symbol, and sets its type to S_OTHER.

Strangely, it will be set to S_STRING by conf_set_sym_val() a few lines
below while it is obviously bool or tristate type. On the other hand,
when CONFIG_BAR="bar" is being dropped from include/config/auto.conf,
its type remains S_OTHER. Because for_all_symbols() omits S_OTHER
symbols, conf_touch_deps() misses to touch include/config/bar.h

This behavior has been a pretty mystery for me, and digging the git
histroy did not help. At least, touching depfiles is broken for string
type symbols.

I removed S_OTHER entirely, and reimplemented it more simply.

If CONFIG_FOO was visible in the previous syncconfig, but is missing
now, what we want to do is quite simple; just call conf_touch_dep()
to touch include/config/foo.h instead of allocating a new symbol data.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 1508fec8
...@@ -227,14 +227,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ...@@ -227,14 +227,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
conf_warning("symbol value '%s' invalid for %s", conf_warning("symbol value '%s' invalid for %s",
p, sym->name); p, sym->name);
return 1; return 1;
case S_OTHER:
if (*p != '"') {
for (p2 = p; *p2 && !isspace(*p2); p2++)
;
sym->type = S_STRING;
goto done;
}
/* fall through */
case S_STRING: case S_STRING:
if (*p++ != '"') if (*p++ != '"')
break; break;
...@@ -253,7 +245,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ...@@ -253,7 +245,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
/* fall through */ /* fall through */
case S_INT: case S_INT:
case S_HEX: case S_HEX:
done:
if (sym_string_valid(sym, p)) { if (sym_string_valid(sym, p)) {
sym->def[def].val = xstrdup(p); sym->def[def].val = xstrdup(p);
sym->flags |= def_flags; sym->flags |= def_flags;
...@@ -434,17 +425,22 @@ int conf_read_simple(const char *name, int def) ...@@ -434,17 +425,22 @@ int conf_read_simple(const char *name, int def)
if (*p2 == '\r') if (*p2 == '\r')
*p2 = 0; *p2 = 0;
} }
if (def == S_DEF_USER) {
sym = sym_find(line + strlen(CONFIG_)); sym = sym_find(line + strlen(CONFIG_));
if (!sym) { if (!sym) {
if (def == S_DEF_AUTO)
/*
* Reading from include/config/auto.conf
* If CONFIG_FOO previously existed in
* auto.conf but it is missing now,
* include/config/foo.h must be touched.
*/
conf_touch_dep(line + strlen(CONFIG_));
else
sym_add_change_count(1); sym_add_change_count(1);
continue; continue;
}
} else {
sym = sym_lookup(line + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_OTHER;
} }
if (sym->flags & def_flags) { if (sym->flags & def_flags) {
conf_warning("override: reassigning to symbol %s", sym->name); conf_warning("override: reassigning to symbol %s", sym->name);
} }
...@@ -710,7 +706,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, ...@@ -710,7 +706,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym,
const char *str; const char *str;
switch (sym->type) { switch (sym->type) {
case S_OTHER:
case S_UNKNOWN: case S_UNKNOWN:
break; break;
case S_STRING: case S_STRING:
......
...@@ -62,7 +62,7 @@ struct symbol_value { ...@@ -62,7 +62,7 @@ struct symbol_value {
}; };
enum symbol_type { enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
}; };
/* enum values are used as index to symbol.def[] */ /* enum values are used as index to symbol.def[] */
...@@ -131,7 +131,7 @@ struct symbol { ...@@ -131,7 +131,7 @@ struct symbol {
struct expr_value implied; struct expr_value implied;
}; };
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) #define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
#define SYMBOL_CONST 0x0001 /* symbol is const */ #define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */ #define SYMBOL_CHECK 0x0008 /* used during dependency checking */
......
...@@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type) ...@@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type)
return "string"; return "string";
case S_UNKNOWN: case S_UNKNOWN:
return "unknown"; return "unknown";
case S_OTHER:
break;
} }
return "???"; return "???";
} }
...@@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym) ...@@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym)
return str; return str;
case S_STRING: case S_STRING:
return str; return str;
case S_OTHER:
case S_UNKNOWN: case S_UNKNOWN:
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment