Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: introduce menu type enum

Currently, menu->prompt->type is checked to distinguish "comment"
(P_COMMENT) and "menu" (P_MENU) entries from regular "config" entries.
This is odd because P_COMMENT and P_MENU are not properties.

This commit introduces menu type enum to distinguish menu types more
naturally.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+21 -9
+11
scripts/kconfig/expr.h
··· 205 205 for (st = sym->prop; st; st = st->next) \ 206 206 if (st->text) 207 207 208 + enum menu_type { 209 + M_CHOICE, // "choice" 210 + M_COMMENT, // "comment" 211 + M_IF, // "if" 212 + M_MENU, // "mainmenu", "menu", "menuconfig" 213 + M_NORMAL, // others, i.e., "config" 214 + }; 215 + 208 216 /* 209 217 * Represents a node in the menu tree, as seen in e.g. menuconfig (though used 210 218 * for all front ends). Each symbol, menu, etc. defined in the Kconfig files 211 219 * gets a node. A symbol defined in multiple locations gets one node at each 212 220 * location. 213 221 * 222 + * @type: type of the menu entry 214 223 * @choice_members: list of choice members with priority. 215 224 */ 216 225 struct menu { 226 + enum menu_type type; 227 + 217 228 /* The next menu node at the same level */ 218 229 struct menu *next; 219 230
+1 -1
scripts/kconfig/lkc.h
··· 81 81 void menu_warn(const struct menu *menu, const char *fmt, ...); 82 82 struct menu *menu_add_menu(void); 83 83 void menu_end_menu(void); 84 - void menu_add_entry(struct symbol *sym); 84 + void menu_add_entry(struct symbol *sym, enum menu_type type); 85 85 void menu_add_dep(struct expr *dep); 86 86 void menu_add_visibility(struct expr *dep); 87 87 struct property *menu_add_prompt(enum prop_type type, const char *prompt,
+3 -2
scripts/kconfig/menu.c
··· 15 15 16 16 static const char nohelp_text[] = "There is no help available for this option."; 17 17 18 - struct menu rootmenu; 18 + struct menu rootmenu = { .type = M_MENU }; 19 19 static struct menu **last_entry_ptr; 20 20 21 21 /** ··· 65 65 last_entry_ptr = &rootmenu.list; 66 66 } 67 67 68 - void menu_add_entry(struct symbol *sym) 68 + void menu_add_entry(struct symbol *sym, enum menu_type type) 69 69 { 70 70 struct menu *menu; 71 71 72 72 menu = xmalloc(sizeof(*menu)); 73 73 memset(menu, 0, sizeof(*menu)); 74 + menu->type = type; 74 75 menu->sym = sym; 75 76 menu->parent = current_menu; 76 77 menu->filename = cur_filename;
+6 -6
scripts/kconfig/parser.y
··· 139 139 140 140 config_entry_start: T_CONFIG nonconst_symbol T_EOL 141 141 { 142 - menu_add_entry($2); 142 + menu_add_entry($2, M_NORMAL); 143 143 printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, $2->name); 144 144 }; 145 145 ··· 173 173 174 174 menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL 175 175 { 176 - menu_add_entry($2); 176 + menu_add_entry($2, M_MENU); 177 177 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, $2->name); 178 178 }; 179 179 ··· 246 246 { 247 247 struct symbol *sym = sym_lookup(NULL, 0); 248 248 249 - menu_add_entry(sym); 249 + menu_add_entry(sym, M_CHOICE); 250 250 menu_set_type(S_BOOLEAN); 251 251 INIT_LIST_HEAD(&current_entry->choice_members); 252 252 ··· 315 315 if_entry: T_IF expr T_EOL 316 316 { 317 317 printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno); 318 - menu_add_entry(NULL); 318 + menu_add_entry(NULL, M_IF); 319 319 menu_add_dep($2); 320 320 $$ = menu_add_menu(); 321 321 }; ··· 338 338 339 339 menu: T_MENU T_WORD_QUOTE T_EOL 340 340 { 341 - menu_add_entry(NULL); 341 + menu_add_entry(NULL, M_MENU); 342 342 menu_add_prompt(P_MENU, $2, NULL); 343 343 printd(DEBUG_PARSE, "%s:%d:menu\n", cur_filename, cur_lineno); 344 344 }; ··· 376 376 377 377 comment: T_COMMENT T_WORD_QUOTE T_EOL 378 378 { 379 - menu_add_entry(NULL); 379 + menu_add_entry(NULL, M_COMMENT); 380 380 menu_add_prompt(P_COMMENT, $2, NULL); 381 381 printd(DEBUG_PARSE, "%s:%d:comment\n", cur_filename, cur_lineno); 382 382 };