summaryrefslogtreecommitdiff
path: root/scripts/kconfig
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/kconf_id.c3
-rw-r--r--scripts/kconfig/lkc.h9
-rw-r--r--scripts/kconfig/menu.c43
-rw-r--r--scripts/kconfig/zconf.l3
-rw-r--r--scripts/kconfig/zconf.y35
5 files changed, 41 insertions, 52 deletions
diff --git a/scripts/kconfig/kconf_id.c b/scripts/kconfig/kconf_id.c
index ec2c011f9e62..f8b222cc8b87 100644
--- a/scripts/kconfig/kconf_id.c
+++ b/scripts/kconfig/kconf_id.c
@@ -30,9 +30,6 @@ static struct kconf_id kconf_id_array[] = {
{ "visible", T_VISIBLE, TF_COMMAND },
{ "option", T_OPTION, TF_COMMAND },
{ "on", T_ON, TF_PARAM },
- { "modules", T_OPT_MODULES, TF_OPTION },
- { "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
- { "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
};
#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index b6bbcd1dda2b..5f4880a12246 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -32,7 +32,6 @@ static inline const char *CONFIG_prefix(void)
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
-#define TF_OPTION 0x0004
enum conf_def_mode {
def_default,
@@ -42,10 +41,6 @@ enum conf_def_mode {
def_random
};
-#define T_OPT_MODULES 1
-#define T_OPT_DEFCONFIG_LIST 2
-#define T_OPT_ALLNOCONFIG_Y 4
-
struct kconf_id {
const char *name;
int token;
@@ -90,7 +85,9 @@ void menu_add_visibility(struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
-void menu_add_option(int token, char *arg);
+void menu_add_option_modules(void);
+void menu_add_option_defconfig_list(void);
+void menu_add_option_allnoconfig_y(void);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4cf15d449c05..7e2b2c938d7b 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -195,29 +195,26 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
}
-void menu_add_option(int token, char *arg)
-{
- switch (token) {
- case T_OPT_MODULES:
- if (modules_sym)
- zconf_error("symbol '%s' redefines option 'modules'"
- " already defined by symbol '%s'",
- current_entry->sym->name,
- modules_sym->name
- );
- modules_sym = current_entry->sym;
- break;
- case T_OPT_DEFCONFIG_LIST:
- if (!sym_defconfig_list)
- sym_defconfig_list = current_entry->sym;
- else if (sym_defconfig_list != current_entry->sym)
- zconf_error("trying to redefine defconfig symbol");
- sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
- break;
- case T_OPT_ALLNOCONFIG_Y:
- current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
- break;
- }
+void menu_add_option_modules(void)
+{
+ if (modules_sym)
+ zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
+ current_entry->sym->name, modules_sym->name);
+ modules_sym = current_entry->sym;
+}
+
+void menu_add_option_defconfig_list(void)
+{
+ if (!sym_defconfig_list)
+ sym_defconfig_list = current_entry->sym;
+ else if (sym_defconfig_list != current_entry->sym)
+ zconf_error("trying to redefine defconfig symbol");
+ sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
+}
+
+void menu_add_option_allnoconfig_y(void)
+{
+ current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
}
static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 8e856f9e6da9..30380790bab4 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -140,6 +140,9 @@ n [A-Za-z0-9_-]
}
<PARAM>{
+ "modules" return T_MODULES;
+ "defconfig_list" return T_DEFCONFIG_LIST;
+ "allnoconfig_y" return T_ALLNOCONFIG_Y;
"&&" return T_AND;
"||" return T_OR;
"(" return T_OPEN_PAREN;
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 19fa333e9aa1..e482000bb93e 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -64,18 +64,21 @@ static struct menu *current_menu, *current_entry;
%token <id>T_IMPLY
%token <id>T_RANGE
%token <id>T_VISIBLE
-%token <id>T_OPTION
%token <id>T_ON
%token <string> T_WORD
%token <string> T_WORD_QUOTE
+%token T_ALLNOCONFIG_Y
%token T_BOOL
%token T_CLOSE_PAREN
%token T_DEFAULT
+%token T_DEFCONFIG_LIST
%token T_DEF_BOOL
%token T_DEF_TRISTATE
%token T_HEX
%token T_INT
+%token T_MODULES
%token T_OPEN_PAREN
+%token T_OPTION
%token T_STRING
%token T_TRISTATE
%token T_EOL
@@ -97,7 +100,7 @@ static struct menu *current_menu, *current_entry;
%type <expr> if_expr
%type <id> end
%type <menu> if_entry menu_entry choice_entry
-%type <string> symbol_option_arg word_opt assign_val
+%type <string> word_opt assign_val
%destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -172,7 +175,6 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
config_option_list:
/* empty */
| config_option_list config_option
- | config_option_list symbol_option
| config_option_list depends
| config_option_list help
;
@@ -219,27 +221,20 @@ config_option: T_RANGE symbol symbol if_expr T_EOL
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
};
-symbol_option: T_OPTION symbol_option_list T_EOL
-;
+config_option: T_OPTION T_MODULES T_EOL
+{
+ menu_add_option_modules();
+};
-symbol_option_list:
- /* empty */
- | symbol_option_list T_WORD symbol_option_arg
+config_option: T_OPTION T_DEFCONFIG_LIST T_EOL
{
- const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
- if (id && id->flags & TF_OPTION) {
- menu_add_option(id->token, $3);
- free($3);
- }
- else
- zconfprint("warning: ignoring unknown option %s", $2);
- free($2);
+ menu_add_option_defconfig_list();
};
-symbol_option_arg:
- /* empty */ { $$ = NULL; }
- | T_EQUAL prompt { $$ = $2; }
-;
+config_option: T_OPTION T_ALLNOCONFIG_Y T_EOL
+{
+ menu_add_option_allnoconfig_y();
+};
/* choice entry */