Commit 1da251c6 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remove SYMBOL_CHOICE flag

All symbols except choices have a name.

Previously, choices were allowed to have a name, but commit c83f0209
("kconfig: remove named choice support") eliminated that possibility.

Now, it is easy to distinguish choices from normal symbols; if the name
is NULL, it is a choice.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
parent 2b1ab140
...@@ -888,7 +888,7 @@ int conf_write(const char *name) ...@@ -888,7 +888,7 @@ int conf_write(const char *name)
"# %s\n" "# %s\n"
"#\n", str); "#\n", str);
need_newline = false; need_newline = false;
} else if (!(sym->flags & SYMBOL_CHOICE) && } else if (!sym_is_choice(sym) &&
!(sym->flags & SYMBOL_WRITTEN)) { !(sym->flags & SYMBOL_WRITTEN)) {
sym_calc_value(sym); sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE)) if (!(sym->flags & SYMBOL_WRITE))
......
...@@ -72,8 +72,7 @@ enum { ...@@ -72,8 +72,7 @@ enum {
/* /*
* Represents a configuration symbol. * Represents a configuration symbol.
* *
* Choices are represented as a special kind of symbol and have the * Choices are represented as a special kind of symbol with null name.
* SYMBOL_CHOICE bit set in 'flags'.
*/ */
struct symbol { struct symbol {
/* link node for the hash table */ /* link node for the hash table */
...@@ -131,7 +130,6 @@ struct symbol { ...@@ -131,7 +130,6 @@ struct symbol {
#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 */
#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */ #define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */ #define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
......
...@@ -83,8 +83,6 @@ static const char *dbg_sym_flags(int val) ...@@ -83,8 +83,6 @@ static const char *dbg_sym_flags(int val)
strcat(buf, "const/"); strcat(buf, "const/");
if (val & SYMBOL_CHECK) if (val & SYMBOL_CHECK)
strcat(buf, "check/"); strcat(buf, "check/");
if (val & SYMBOL_CHOICE)
strcat(buf, "choice/");
if (val & SYMBOL_CHOICEVAL) if (val & SYMBOL_CHOICEVAL)
strcat(buf, "choiceval/"); strcat(buf, "choiceval/");
if (val & SYMBOL_VALID) if (val & SYMBOL_VALID)
......
...@@ -129,7 +129,8 @@ static inline struct symbol *sym_get_choice_value(struct symbol *sym) ...@@ -129,7 +129,8 @@ static inline struct symbol *sym_get_choice_value(struct symbol *sym)
static inline bool sym_is_choice(struct symbol *sym) static inline bool sym_is_choice(struct symbol *sym)
{ {
return sym->flags & SYMBOL_CHOICE ? true : false; /* A choice is a symbol with no name */
return sym->name == NULL;
} }
static inline bool sym_is_choice_value(struct symbol *sym) static inline bool sym_is_choice_value(struct symbol *sym)
......
...@@ -224,7 +224,7 @@ config_option: T_MODULES T_EOL ...@@ -224,7 +224,7 @@ config_option: T_MODULES T_EOL
choice: T_CHOICE T_EOL choice: T_CHOICE T_EOL
{ {
struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE); struct symbol *sym = sym_lookup(NULL, 0);
sym->flags |= SYMBOL_NO_WRITE; sym->flags |= SYMBOL_NO_WRITE;
menu_add_entry(sym); menu_add_entry(sym);
menu_add_expr(P_CHOICE, NULL, NULL); menu_add_expr(P_CHOICE, NULL, NULL);
......
...@@ -827,7 +827,7 @@ struct symbol *sym_lookup(const char *name, int flags) ...@@ -827,7 +827,7 @@ struct symbol *sym_lookup(const char *name, int flags)
if (symbol->name && if (symbol->name &&
!strcmp(symbol->name, name) && !strcmp(symbol->name, name) &&
(flags ? symbol->flags & flags (flags ? symbol->flags & flags
: !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE)))) : !(symbol->flags & SYMBOL_CONST)))
return symbol; return symbol;
} }
new_name = xstrdup(name); new_name = xstrdup(name);
......
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