diff options
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r-- | scripts/kconfig/menu.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 0fce20cb7f3c..c86c27f2c761 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -114,7 +114,7 @@ void menu_set_type(int type) | |||
114 | sym->type = type; | 114 | sym->type = type; |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", | 117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'", |
118 | sym->name ? sym->name : "<choice>", | 118 | sym->name ? sym->name : "<choice>", |
119 | sym_type_name(sym->type), sym_type_name(type)); | 119 | sym_type_name(sym->type), sym_type_name(type)); |
120 | } | 120 | } |
@@ -124,15 +124,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
124 | struct property *prop = prop_alloc(type, current_entry->sym); | 124 | struct property *prop = prop_alloc(type, current_entry->sym); |
125 | 125 | ||
126 | prop->menu = current_entry; | 126 | prop->menu = current_entry; |
127 | prop->text = prompt; | ||
128 | prop->expr = expr; | 127 | prop->expr = expr; |
129 | prop->visible.expr = menu_check_dep(dep); | 128 | prop->visible.expr = menu_check_dep(dep); |
130 | 129 | ||
131 | if (prompt) { | 130 | if (prompt) { |
131 | if (isspace(*prompt)) { | ||
132 | prop_warn(prop, "leading whitespace ignored"); | ||
133 | while (isspace(*prompt)) | ||
134 | prompt++; | ||
135 | } | ||
132 | if (current_entry->prompt) | 136 | if (current_entry->prompt) |
133 | menu_warn(current_entry, "prompt redefined\n"); | 137 | prop_warn(prop, "prompt redefined"); |
134 | current_entry->prompt = prop; | 138 | current_entry->prompt = prop; |
135 | } | 139 | } |
140 | prop->text = prompt; | ||
136 | 141 | ||
137 | return prop; | 142 | return prop; |
138 | } | 143 | } |
@@ -152,6 +157,24 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) | |||
152 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); | 157 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); |
153 | } | 158 | } |
154 | 159 | ||
160 | void menu_add_option(int token, char *arg) | ||
161 | { | ||
162 | struct property *prop; | ||
163 | |||
164 | switch (token) { | ||
165 | case T_OPT_MODULES: | ||
166 | prop = prop_alloc(P_DEFAULT, modules_sym); | ||
167 | prop->expr = expr_alloc_symbol(current_entry->sym); | ||
168 | break; | ||
169 | case T_OPT_DEFCONFIG_LIST: | ||
170 | if (!sym_defconfig_list) | ||
171 | sym_defconfig_list = current_entry->sym; | ||
172 | else if (sym_defconfig_list != current_entry->sym) | ||
173 | zconf_error("trying to redefine defconfig symbol"); | ||
174 | break; | ||
175 | } | ||
176 | } | ||
177 | |||
155 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | 178 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) |
156 | { | 179 | { |
157 | return sym2->type == S_INT || sym2->type == S_HEX || | 180 | return sym2->type == S_INT || sym2->type == S_HEX || |
@@ -325,11 +348,10 @@ void menu_finalize(struct menu *parent) | |||
325 | 348 | ||
326 | if (sym && !(sym->flags & SYMBOL_WARNED)) { | 349 | if (sym && !(sym->flags & SYMBOL_WARNED)) { |
327 | if (sym->type == S_UNKNOWN) | 350 | if (sym->type == S_UNKNOWN) |
328 | menu_warn(parent, "config symbol defined " | 351 | menu_warn(parent, "config symbol defined without type"); |
329 | "without type\n"); | ||
330 | 352 | ||
331 | if (sym_is_choice(sym) && !parent->prompt) | 353 | if (sym_is_choice(sym) && !parent->prompt) |
332 | menu_warn(parent, "choice must have a prompt\n"); | 354 | menu_warn(parent, "choice must have a prompt"); |
333 | 355 | ||
334 | /* Check properties connected to this symbol */ | 356 | /* Check properties connected to this symbol */ |
335 | sym_check_prop(sym); | 357 | sym_check_prop(sym); |