Skip to content

Commit 1da251c

Browse files
committed
kconfig: remove SYMBOL_CHOICE flag
All symbols except choices have a name. Previously, choices were allowed to have a name, but commit c83f020 ("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: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
1 parent 2b1ab14 commit 1da251c

6 files changed

Lines changed: 6 additions & 9 deletions

File tree

scripts/kconfig/confdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ int conf_write(const char *name)
888888
"# %s\n"
889889
"#\n", str);
890890
need_newline = false;
891-
} else if (!(sym->flags & SYMBOL_CHOICE) &&
891+
} else if (!sym_is_choice(sym) &&
892892
!(sym->flags & SYMBOL_WRITTEN)) {
893893
sym_calc_value(sym);
894894
if (!(sym->flags & SYMBOL_WRITE))

scripts/kconfig/expr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ enum {
7272
/*
7373
* Represents a configuration symbol.
7474
*
75-
* Choices are represented as a special kind of symbol and have the
76-
* SYMBOL_CHOICE bit set in 'flags'.
75+
* Choices are represented as a special kind of symbol with null name.
7776
*/
7877
struct symbol {
7978
/* link node for the hash table */
@@ -131,7 +130,6 @@ struct symbol {
131130

132131
#define SYMBOL_CONST 0x0001 /* symbol is const */
133132
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
134-
#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
135133
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
136134
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
137135
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */

scripts/kconfig/gconf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ static const char *dbg_sym_flags(int val)
8383
strcat(buf, "const/");
8484
if (val & SYMBOL_CHECK)
8585
strcat(buf, "check/");
86-
if (val & SYMBOL_CHOICE)
87-
strcat(buf, "choice/");
8886
if (val & SYMBOL_CHOICEVAL)
8987
strcat(buf, "choiceval/");
9088
if (val & SYMBOL_VALID)

scripts/kconfig/lkc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ static inline struct symbol *sym_get_choice_value(struct symbol *sym)
129129

130130
static inline bool sym_is_choice(struct symbol *sym)
131131
{
132-
return sym->flags & SYMBOL_CHOICE ? true : false;
132+
/* A choice is a symbol with no name */
133+
return sym->name == NULL;
133134
}
134135

135136
static inline bool sym_is_choice_value(struct symbol *sym)

scripts/kconfig/parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ config_option: T_MODULES T_EOL
224224

225225
choice: T_CHOICE T_EOL
226226
{
227-
struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE);
227+
struct symbol *sym = sym_lookup(NULL, 0);
228228
sym->flags |= SYMBOL_NO_WRITE;
229229
menu_add_entry(sym);
230230
menu_add_expr(P_CHOICE, NULL, NULL);

scripts/kconfig/symbol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ struct symbol *sym_lookup(const char *name, int flags)
827827
if (symbol->name &&
828828
!strcmp(symbol->name, name) &&
829829
(flags ? symbol->flags & flags
830-
: !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
830+
: !(symbol->flags & SYMBOL_CONST)))
831831
return symbol;
832832
}
833833
new_name = xstrdup(name);

0 commit comments

Comments
 (0)