Skip to content

Commit

Permalink
kconfig: m/nconf: remove dead code to display children of choice members
Browse files Browse the repository at this point in the history
This code previously displayed child symbols of the selected choice
member.

Since commit 7e3465f ("kconfig: do not reparent the menu inside
a choice block"), choice members never have child symbols, therefore
this is dead code.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed May 14, 2024
1 parent 6ba750d commit e89b461
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 95 deletions.
81 changes: 35 additions & 46 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,6 @@ static void build_conf(struct menu *menu)
if (def_menu) {
item_add_str(" (%s)", menu_get_prompt(def_menu));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
build_conf(def_menu);
indent -= 2;
}
}
return;
}
Expand All @@ -568,49 +563,43 @@ static void build_conf(struct menu *menu)
}
child_count++;
val = sym_get_tristate_value(sym);
if (sym_is_choice_value(sym) && val == yes) {
item_make(" ");
item_set_tag(':');
switch (type) {
case S_BOOLEAN:
if (sym_is_changeable(sym))
item_make("[%c]", val == no ? ' ' : '*');
else
item_make("-%c-", val == no ? ' ' : '*');
item_set_tag('t');
item_set_data(menu);
} else {
switch (type) {
case S_BOOLEAN:
if (sym_is_changeable(sym))
item_make("[%c]", val == no ? ' ' : '*');
else
item_make("-%c-", val == no ? ' ' : '*');
item_set_tag('t');
item_set_data(menu);
break;
case S_TRISTATE:
switch (val) {
case yes: ch = '*'; break;
case mod: ch = 'M'; break;
default: ch = ' '; break;
}
if (sym_is_changeable(sym)) {
if (sym->rev_dep.tri == mod)
item_make("{%c}", ch);
else
item_make("<%c>", ch);
} else
item_make("-%c-", ch);
item_set_tag('t');
item_set_data(menu);
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
item_make("(%s)", sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changeable(sym)) ?
"" : " (NEW)");
item_set_tag('s');
item_set_data(menu);
goto conf_childs;
break;
case S_TRISTATE:
switch (val) {
case yes: ch = '*'; break;
case mod: ch = 'M'; break;
default: ch = ' '; break;
}
if (sym_is_changeable(sym)) {
if (sym->rev_dep.tri == mod)
item_make("{%c}", ch);
else
item_make("<%c>", ch);
} else
item_make("-%c-", ch);
item_set_tag('t');
item_set_data(menu);
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
item_make("(%s)", sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changeable(sym)) ?
"" : " (NEW)");
item_set_tag('s');
item_set_data(menu);
goto conf_childs;
}
item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changeable(sym)) ?
Expand Down
85 changes: 36 additions & 49 deletions scripts/kconfig/nconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,11 +857,6 @@ static void build_conf(struct menu *menu)
item_add_str(" (%s)",
menu_get_prompt(def_menu));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
build_conf(def_menu);
indent -= 2;
}
}
return;
}
Expand All @@ -874,54 +869,46 @@ static void build_conf(struct menu *menu)
}
child_count++;
val = sym_get_tristate_value(sym);
if (sym_is_choice_value(sym) && val == yes) {
item_make(menu, ':', " ");
} else {
switch (type) {
case S_BOOLEAN:
if (sym_is_changeable(sym))
item_make(menu, 't', "[%c]",
val == no ? ' ' : '*');
else
item_make(menu, 't', "-%c-",
val == no ? ' ' : '*');
switch (type) {
case S_BOOLEAN:
if (sym_is_changeable(sym))
item_make(menu, 't', "[%c]",
val == no ? ' ' : '*');
else
item_make(menu, 't', "-%c-",
val == no ? ' ' : '*');
break;
case S_TRISTATE:
switch (val) {
case yes:
ch = '*';
break;
case S_TRISTATE:
switch (val) {
case yes:
ch = '*';
break;
case mod:
ch = 'M';
break;
default:
ch = ' ';
break;
}
if (sym_is_changeable(sym)) {
if (sym->rev_dep.tri == mod)
item_make(menu,
't', "{%c}", ch);
else
item_make(menu,
't', "<%c>", ch);
} else
item_make(menu, 't', "-%c-", ch);
case mod:
ch = 'M';
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym));
item_make(menu, 's', " (%s)",
sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ',
menu_get_prompt(menu),
(sym_has_value(sym) ||
!sym_is_changeable(sym)) ? "" :
" (NEW)");
goto conf_childs;
ch = ' ';
break;
}
if (sym_is_changeable(sym)) {
if (sym->rev_dep.tri == mod)
item_make(menu, 't', "{%c}", ch);
else
item_make(menu, 't', "<%c>", ch);
} else
item_make(menu, 't', "-%c-", ch);
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym));
item_make(menu, 's', " (%s)",
sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
(sym_has_value(sym) ||
!sym_is_changeable(sym)) ? "" : " (NEW)");
goto conf_childs;
}
item_add_str("%*c%s%s", indent + 1, ' ',
menu_get_prompt(menu),
Expand Down

0 comments on commit e89b461

Please sign in to comment.