aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/expr.h1
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/menu.c11
-rw-r--r--scripts/kconfig/zconf.gperf1
-rw-r--r--scripts/kconfig/zconf.y21
5 files changed, 32 insertions, 3 deletions
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 184eb6a0b505..e57826ced380 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -164,6 +164,7 @@ struct menu {
164 struct menu *list; 164 struct menu *list;
165 struct symbol *sym; 165 struct symbol *sym;
166 struct property *prompt; 166 struct property *prompt;
167 struct expr *visibility;
167 struct expr *dep; 168 struct expr *dep;
168 unsigned int flags; 169 unsigned int flags;
169 char *help; 170 char *help;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 753cdbd7b805..3f7240df0f3b 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -107,6 +107,7 @@ void menu_end_menu(void);
107void menu_add_entry(struct symbol *sym); 107void menu_add_entry(struct symbol *sym);
108void menu_end_entry(void); 108void menu_end_entry(void);
109void menu_add_dep(struct expr *dep); 109void menu_add_dep(struct expr *dep);
110void menu_add_visibility(struct expr *dep);
110struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); 111struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
111struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 112struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
112void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 113void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e83aef42c6d..b9d9aa18e6d6 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -152,6 +152,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
152 return menu_add_prop(type, prompt, NULL, dep); 152 return menu_add_prop(type, prompt, NULL, dep);
153} 153}
154 154
155void menu_add_visibility(struct expr *expr)
156{
157 current_entry->visibility = expr_alloc_and(current_entry->visibility,
158 expr);
159}
160
155void 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)
156{ 162{
157 menu_add_prop(type, NULL, expr, dep); 163 menu_add_prop(type, NULL, expr, dep);
@@ -410,6 +416,11 @@ bool menu_is_visible(struct menu *menu)
410 if (!menu->prompt) 416 if (!menu->prompt)
411 return false; 417 return false;
412 418
419 if (menu->visibility) {
420 if (expr_calc_value(menu->visibility) == no)
421 return no;
422 }
423
413 sym = menu->sym; 424 sym = menu->sym;
414 if (sym) { 425 if (sym) {
415 sym_calc_value(sym); 426 sym_calc_value(sym);
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index d8bc74249622..c9e690eb7545 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -38,6 +38,7 @@ hex, T_TYPE, TF_COMMAND, S_HEX
38string, T_TYPE, TF_COMMAND, S_STRING 38string, T_TYPE, TF_COMMAND, S_STRING
39select, T_SELECT, TF_COMMAND 39select, T_SELECT, TF_COMMAND
40range, T_RANGE, TF_COMMAND 40range, T_RANGE, TF_COMMAND
41visible, T_VISIBLE, TF_COMMAND
41option, T_OPTION, TF_COMMAND 42option, T_OPTION, TF_COMMAND
42on, T_ON, TF_PARAM 43on, T_ON, TF_PARAM
43modules, T_OPT_MODULES, TF_OPTION 44modules, T_OPT_MODULES, TF_OPTION
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 2abd3c7ff15d..49fb4ab664c3 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
36#define YYERROR_VERBOSE 36#define YYERROR_VERBOSE
37#endif 37#endif
38%} 38%}
39%expect 28 39%expect 30
40 40
41%union 41%union
42{ 42{
@@ -68,6 +68,7 @@ static struct menu *current_menu, *current_entry;
68%token <id>T_DEFAULT 68%token <id>T_DEFAULT
69%token <id>T_SELECT 69%token <id>T_SELECT
70%token <id>T_RANGE 70%token <id>T_RANGE
71%token <id>T_VISIBLE
71%token <id>T_OPTION 72%token <id>T_OPTION
72%token <id>T_ON 73%token <id>T_ON
73%token <string> T_WORD 74%token <string> T_WORD
@@ -123,7 +124,7 @@ stmt_list:
123; 124;
124 125
125option_name: 126option_name:
126 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT 127 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
127; 128;
128 129
129common_stmt: 130common_stmt:
@@ -359,7 +360,7 @@ menu: T_MENU prompt T_EOL
359 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 360 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
360}; 361};
361 362
362menu_entry: menu depends_list 363menu_entry: menu visibility_list depends_list
363{ 364{
364 $$ = menu_add_menu(); 365 $$ = menu_add_menu();
365}; 366};
@@ -430,6 +431,19 @@ depends: T_DEPENDS T_ON expr T_EOL
430 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); 431 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
431}; 432};
432 433
434/* visibility option */
435
436visibility_list:
437 /* empty */
438 | visibility_list visible
439 | visibility_list T_EOL
440;
441
442visible: T_VISIBLE if_expr
443{
444 menu_add_visibility($2);
445};
446
433/* prompt statement */ 447/* prompt statement */
434 448
435prompt_stmt_opt: 449prompt_stmt_opt:
@@ -526,6 +540,7 @@ static const char *zconf_tokenname(int token)
526 case T_IF: return "if"; 540 case T_IF: return "if";
527 case T_ENDIF: return "endif"; 541 case T_ENDIF: return "endif";
528 case T_DEPENDS: return "depends"; 542 case T_DEPENDS: return "depends";
543 case T_VISIBLE: return "visible";
529 } 544 }
530 return "<token>"; 545 return "<token>";
531} 546}