aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r--scripts/kconfig/menu.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4fb590247f33..b9d9aa18e6d6 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -10,7 +10,7 @@
10#include "lkc.h" 10#include "lkc.h"
11 11
12static const char nohelp_text[] = N_( 12static const char nohelp_text[] = N_(
13 "There is no help available for this kernel option.\n"); 13 "There is no help available for this option.\n");
14 14
15struct menu rootmenu; 15struct menu rootmenu;
16static struct menu **last_entry_ptr; 16static struct menu **last_entry_ptr;
@@ -107,7 +107,6 @@ static struct expr *menu_check_dep(struct expr *e)
107void menu_add_dep(struct expr *dep) 107void menu_add_dep(struct expr *dep)
108{ 108{
109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); 109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
110 current_entry->dir_dep = current_entry->dep;
111} 110}
112 111
113void menu_set_type(int type) 112void menu_set_type(int type)
@@ -139,7 +138,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
139 while (isspace(*prompt)) 138 while (isspace(*prompt))
140 prompt++; 139 prompt++;
141 } 140 }
142 if (current_entry->prompt) 141 if (current_entry->prompt && current_entry != &rootmenu)
143 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
144 current_entry->prompt = prop; 143 current_entry->prompt = prop;
145 } 144 }
@@ -153,6 +152,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
153 return menu_add_prop(type, prompt, NULL, dep); 152 return menu_add_prop(type, prompt, NULL, dep);
154} 153}
155 154
155void menu_add_visibility(struct expr *expr)
156{
157 current_entry->visibility = expr_alloc_and(current_entry->visibility,
158 expr);
159}
160
156void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) 161void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
157{ 162{
158 menu_add_prop(type, NULL, expr, dep); 163 menu_add_prop(type, NULL, expr, dep);
@@ -291,10 +296,6 @@ void menu_finalize(struct menu *parent)
291 for (menu = parent->list; menu; menu = menu->next) 296 for (menu = parent->list; menu; menu = menu->next)
292 menu_finalize(menu); 297 menu_finalize(menu);
293 } else if (sym) { 298 } else if (sym) {
294 /* ignore inherited dependencies for dir_dep */
295 sym->dir_dep.expr = expr_transform(expr_copy(parent->dir_dep));
296 sym->dir_dep.expr = expr_eliminate_dups(sym->dir_dep.expr);
297
298 basedep = parent->prompt ? parent->prompt->visible.expr : NULL; 299 basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
299 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); 300 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
300 basedep = expr_eliminate_dups(expr_transform(basedep)); 301 basedep = expr_eliminate_dups(expr_transform(basedep));
@@ -325,6 +326,8 @@ void menu_finalize(struct menu *parent)
325 parent->next = last_menu->next; 326 parent->next = last_menu->next;
326 last_menu->next = NULL; 327 last_menu->next = NULL;
327 } 328 }
329
330 sym->dir_dep.expr = parent->dep;
328 } 331 }
329 for (menu = parent->list; menu; menu = menu->next) { 332 for (menu = parent->list; menu; menu = menu->next) {
330 if (sym && sym_is_choice(sym) && 333 if (sym && sym_is_choice(sym) &&
@@ -413,6 +416,11 @@ bool menu_is_visible(struct menu *menu)
413 if (!menu->prompt) 416 if (!menu->prompt)
414 return false; 417 return false;
415 418
419 if (menu->visibility) {
420 if (expr_calc_value(menu->visibility) == no)
421 return no;
422 }
423
416 sym = menu->sym; 424 sym = menu->sym;
417 if (sym) { 425 if (sym) {
418 sym_calc_value(sym); 426 sym_calc_value(sym);
@@ -566,7 +574,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
566 574
567 if (menu_has_help(menu)) { 575 if (menu_has_help(menu)) {
568 if (sym->name) { 576 if (sym->name) {
569 str_printf(help, "CONFIG_%s:\n\n", sym->name); 577 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
570 str_append(help, _(menu_get_help(menu))); 578 str_append(help, _(menu_get_help(menu)));
571 str_append(help, "\n"); 579 str_append(help, "\n");
572 } 580 }