1 // SPDX-License-Identifier: GPL-2.0
15 struct symbol symbol_yes = {
19 .menus = LIST_HEAD_INIT(symbol_yes.menus),
20 .flags = SYMBOL_CONST|SYMBOL_VALID,
23 struct symbol symbol_mod = {
27 .menus = LIST_HEAD_INIT(symbol_mod.menus),
28 .flags = SYMBOL_CONST|SYMBOL_VALID,
31 struct symbol symbol_no = {
35 .menus = LIST_HEAD_INIT(symbol_no.menus),
36 .flags = SYMBOL_CONST|SYMBOL_VALID,
39 struct symbol *modules_sym;
40 static tristate modules_val;
41 static int sym_warnings;
43 enum symbol_type sym_get_type(const struct symbol *sym)
45 enum symbol_type type = sym->type;
47 if (type == S_TRISTATE && modules_val == no)
52 const char *sym_type_name(enum symbol_type type)
72 * sym_get_choice_menu - get the parent choice menu if present
74 * @sym: a symbol pointer
76 * Return: a choice menu if this function is called against a choice member.
78 struct menu *sym_get_choice_menu(const struct symbol *sym)
80 struct menu *menu = NULL;
84 * Choice members must have a prompt. Find a menu entry with a prompt,
85 * and assume it resides inside a choice block.
87 list_for_each_entry(m, &sym->menus, link)
98 } while (menu && !menu->sym);
100 if (menu && menu->sym && sym_is_choice(menu->sym))
106 static struct property *sym_get_default_prop(struct symbol *sym)
108 struct property *prop;
110 for_all_defaults(sym, prop) {
111 prop->visible.tri = expr_calc_value(prop->visible.expr);
112 if (prop->visible.tri != no)
118 struct property *sym_get_range_prop(struct symbol *sym)
120 struct property *prop;
122 for_all_properties(sym, prop, P_RANGE) {
123 prop->visible.tri = expr_calc_value(prop->visible.expr);
124 if (prop->visible.tri != no)
130 static long long sym_get_range_val(struct symbol *sym, int base)
143 return strtoll(sym->curr.val, NULL, base);
146 static void sym_validate_range(struct symbol *sym)
148 struct property *prop;
149 struct symbol *range_sym;
163 prop = sym_get_range_prop(sym);
166 val = strtoll(sym->curr.val, NULL, base);
167 range_sym = prop->expr->left.sym;
168 val2 = sym_get_range_val(range_sym, base);
170 range_sym = prop->expr->right.sym;
171 val2 = sym_get_range_val(range_sym, base);
175 sym->curr.val = range_sym->curr.val;
178 static void sym_set_changed(struct symbol *sym)
182 list_for_each_entry(menu, &sym->menus, link)
183 menu->flags |= MENU_CHANGED;
186 static void sym_set_all_changed(void)
191 sym_set_changed(sym);
194 static void sym_calc_visibility(struct symbol *sym)
196 struct property *prop;
199 /* any prompt visible? */
201 for_all_prompts(sym, prop) {
202 prop->visible.tri = expr_calc_value(prop->visible.expr);
203 tri = EXPR_OR(tri, prop->visible.tri);
205 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
207 if (sym->visible != tri) {
209 sym_set_changed(sym);
211 if (sym_is_choice_value(sym))
213 /* defaulting to "yes" if no explicit "depends on" are given */
215 if (sym->dir_dep.expr)
216 tri = expr_calc_value(sym->dir_dep.expr);
217 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
219 if (sym->dir_dep.tri != tri) {
220 sym->dir_dep.tri = tri;
221 sym_set_changed(sym);
224 if (sym->rev_dep.expr)
225 tri = expr_calc_value(sym->rev_dep.expr);
226 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
228 if (sym->rev_dep.tri != tri) {
229 sym->rev_dep.tri = tri;
230 sym_set_changed(sym);
233 if (sym->implied.expr)
234 tri = expr_calc_value(sym->implied.expr);
235 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
237 if (sym->implied.tri != tri) {
238 sym->implied.tri = tri;
239 sym_set_changed(sym);
244 * Find the default symbol for a choice.
245 * First try the default values for the choice symbol
246 * Next locate the first visible choice value
247 * Return NULL if none was found
249 struct symbol *sym_choice_default(struct menu *choice)
252 struct symbol *def_sym;
253 struct property *prop;
255 /* any of the defaults visible? */
256 for_all_defaults(choice->sym, prop) {
257 prop->visible.tri = expr_calc_value(prop->visible.expr);
258 if (prop->visible.tri == no)
260 def_sym = prop_get_symbol(prop);
261 if (def_sym->visible != no)
265 /* just get the first visible value */
266 menu_for_each_sub_entry(menu, choice)
267 if (menu->sym && menu->sym->visible != no)
270 /* failed to locate any defaults */
275 * sym_calc_choice - calculate symbol values in a choice
277 * @choice: a menu of the choice
279 * Return: a chosen symbol
281 struct symbol *sym_calc_choice(struct menu *choice)
283 struct symbol *res = NULL;
287 /* Traverse the list of choice members in the priority order. */
288 list_for_each_entry(sym, &choice->choice_members, choice_link) {
289 sym_calc_visibility(sym);
290 if (sym->visible == no)
293 /* The first visible symble with the user value 'y'. */
294 if (sym_has_value(sym) && sym->def[S_DEF_USER].tri == yes) {
301 * If 'y' is not found in the user input, use the default, unless it is
302 * explicitly set to 'n'.
305 res = sym_choice_default(choice);
306 if (res && sym_has_value(res) && res->def[S_DEF_USER].tri == no)
310 /* Still not found. Pick up the first visible, user-unspecified symbol. */
312 menu_for_each_sub_entry(menu, choice) {
315 if (!sym || sym->visible == no || sym_has_value(sym))
324 * Still not found. Traverse the linked list in the _reverse_ order to
325 * pick up the least prioritized 'n'.
328 list_for_each_entry_reverse(sym, &choice->choice_members,
330 if (sym->visible == no)
338 menu_for_each_sub_entry(menu, choice) {
343 if (!sym || sym->visible == no)
346 val = sym == res ? yes : no;
348 if (sym->curr.tri != val)
349 sym_set_changed(sym);
352 sym->flags |= SYMBOL_VALID | SYMBOL_WRITE;
358 static void sym_warn_unmet_dep(const struct symbol *sym)
360 struct gstr gs = str_new();
363 "\nWARNING: unmet direct dependencies detected for %s\n",
366 " Depends on [%c]: ",
367 sym->dir_dep.tri == mod ? 'm' : 'n');
368 expr_gstr_print(sym->dir_dep.expr, &gs);
369 str_printf(&gs, "\n");
371 expr_gstr_print_revdep(sym->rev_dep.expr, &gs, yes,
372 " Selected by [y]:\n");
373 expr_gstr_print_revdep(sym->rev_dep.expr, &gs, mod,
374 " Selected by [m]:\n");
376 fputs(str_get(&gs), stderr);
380 bool sym_dep_errors(void)
383 return getenv("KCONFIG_WERROR");
387 void sym_calc_value(struct symbol *sym)
389 struct symbol_value newval, oldval;
390 struct property *prop;
391 struct menu *choice_menu;
396 if (sym->flags & SYMBOL_VALID)
399 sym->flags |= SYMBOL_VALID;
420 sym->curr.val = sym->name;
424 sym->flags &= ~SYMBOL_WRITE;
426 sym_calc_visibility(sym);
428 if (sym->visible != no)
429 sym->flags |= SYMBOL_WRITE;
431 /* set default if recursively called */
434 switch (sym_get_type(sym)) {
437 choice_menu = sym_get_choice_menu(sym);
440 sym_calc_choice(choice_menu);
441 newval.tri = sym->curr.tri;
443 if (sym->visible != no) {
444 /* if the symbol is visible use the user value
445 * if available, otherwise try the default value
447 if (sym_has_value(sym)) {
448 newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
453 if (sym->rev_dep.tri != no)
454 sym->flags |= SYMBOL_WRITE;
455 if (!sym_is_choice(sym)) {
456 prop = sym_get_default_prop(sym);
458 newval.tri = EXPR_AND(expr_calc_value(prop->expr),
460 if (newval.tri != no)
461 sym->flags |= SYMBOL_WRITE;
463 if (sym->implied.tri != no) {
464 sym->flags |= SYMBOL_WRITE;
465 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
466 newval.tri = EXPR_AND(newval.tri,
471 if (sym->dir_dep.tri < sym->rev_dep.tri)
472 sym_warn_unmet_dep(sym);
473 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
475 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
481 if (sym->visible != no && sym_has_value(sym)) {
482 newval.val = sym->def[S_DEF_USER].val;
485 prop = sym_get_default_prop(sym);
487 struct symbol *ds = prop_get_symbol(prop);
489 sym->flags |= SYMBOL_WRITE;
491 newval.val = ds->curr.val;
500 sym_validate_range(sym);
502 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
503 sym_set_changed(sym);
504 if (modules_sym == sym) {
505 sym_set_all_changed();
506 modules_val = modules_sym->curr.tri;
510 if (sym_is_choice(sym))
511 sym->flags &= ~SYMBOL_WRITE;
514 void sym_clear_all_valid(void)
519 sym->flags &= ~SYMBOL_VALID;
520 conf_set_changed(true);
521 sym_calc_value(modules_sym);
524 bool sym_tristate_within_range(const struct symbol *sym, tristate val)
526 int type = sym_get_type(sym);
528 if (sym->visible == no)
531 if (type != S_BOOLEAN && type != S_TRISTATE)
534 if (type == S_BOOLEAN && val == mod)
536 if (sym->visible <= sym->rev_dep.tri)
538 return val >= sym->rev_dep.tri && val <= sym->visible;
541 bool sym_set_tristate_value(struct symbol *sym, tristate val)
543 tristate oldval = sym_get_tristate_value(sym);
545 if (!sym_tristate_within_range(sym, val))
548 if (!(sym->flags & SYMBOL_DEF_USER) || sym->def[S_DEF_USER].tri != val) {
549 sym->def[S_DEF_USER].tri = val;
550 sym->flags |= SYMBOL_DEF_USER;
551 sym_set_changed(sym);
555 sym_clear_all_valid();
561 * choice_set_value - set the user input to a choice
563 * @choice: menu entry for the choice
564 * @sym: selected symbol
566 void choice_set_value(struct menu *choice, struct symbol *sym)
569 bool changed = false;
571 menu_for_each_sub_entry(menu, choice) {
577 if (menu->sym->visible == no)
580 val = menu->sym == sym ? yes : no;
582 if (menu->sym->curr.tri != val)
585 menu->sym->def[S_DEF_USER].tri = val;
586 menu->sym->flags |= SYMBOL_DEF_USER;
589 * Now, the user has explicitly enabled or disabled this symbol,
590 * it should be given the highest priority. We are possibly
591 * setting multiple symbols to 'n', where the first symbol is
592 * given the least prioritized 'n'. This works well when the
593 * choice block ends up with selecting 'n' symbol.
594 * (see sym_calc_choice())
596 list_move(&menu->sym->choice_link, &choice->choice_members);
600 sym_clear_all_valid();
603 tristate sym_toggle_tristate_value(struct symbol *sym)
606 tristate oldval, newval;
608 choice = sym_get_choice_menu(sym);
610 choice_set_value(choice, sym);
614 oldval = newval = sym_get_tristate_value(sym);
627 if (sym_set_tristate_value(sym, newval))
629 } while (oldval != newval);
633 bool sym_string_valid(struct symbol *sym, const char *str)
646 if (ch == '0' && *str != 0)
648 while ((ch = *str++)) {
654 if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
660 } while ((ch = *str++));
676 bool sym_string_within_range(struct symbol *sym, const char *str)
678 struct property *prop;
683 return sym_string_valid(sym, str);
685 if (!sym_string_valid(sym, str))
687 prop = sym_get_range_prop(sym);
690 val = strtoll(str, NULL, 10);
691 return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
692 val <= sym_get_range_val(prop->expr->right.sym, 10);
694 if (!sym_string_valid(sym, str))
696 prop = sym_get_range_prop(sym);
699 val = strtoll(str, NULL, 16);
700 return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
701 val <= sym_get_range_val(prop->expr->right.sym, 16);
706 return sym_tristate_within_range(sym, yes);
708 return sym_tristate_within_range(sym, mod);
710 return sym_tristate_within_range(sym, no);
718 bool sym_set_string_value(struct symbol *sym, const char *newval)
729 return sym_set_tristate_value(sym, yes);
731 return sym_set_tristate_value(sym, mod);
733 return sym_set_tristate_value(sym, no);
740 if (!sym_string_within_range(sym, newval))
743 if (!(sym->flags & SYMBOL_DEF_USER)) {
744 sym->flags |= SYMBOL_DEF_USER;
745 sym_set_changed(sym);
748 oldval = sym->def[S_DEF_USER].val;
749 size = strlen(newval) + 1;
750 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
752 sym->def[S_DEF_USER].val = val = xmalloc(size);
755 } else if (!oldval || strcmp(oldval, newval))
756 sym->def[S_DEF_USER].val = val = xmalloc(size);
761 free((void *)oldval);
762 sym_clear_all_valid();
768 * Find the default value associated to a symbol.
769 * For tristate symbol handle the modules=n case
770 * in which case "m" becomes "y".
771 * If the symbol does not have any default then fallback
772 * to the fixed default values.
774 const char *sym_get_string_default(struct symbol *sym)
776 struct property *prop;
778 const char *str = "";
781 sym_calc_visibility(sym);
782 sym_calc_value(modules_sym);
783 val = symbol_no.curr.tri;
785 /* If symbol has a default value look it up */
786 prop = sym_get_default_prop(sym);
791 /* The visibility may limit the value from yes => mod */
792 val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
796 * The following fails to handle the situation
797 * where a default value is further limited by
800 ds = prop_get_symbol(prop);
803 str = (const char *)ds->curr.val;
808 /* Handle select statements */
809 val = EXPR_OR(val, sym->rev_dep.tri);
811 /* transpose mod to yes if modules are not enabled */
813 if (!sym_is_choice_value(sym) && modules_sym->curr.tri == no)
816 /* transpose mod to yes if type is bool */
817 if (sym->type == S_BOOLEAN && val == mod)
820 /* adjust the default value if this symbol is implied by another */
821 if (val < sym->implied.tri)
822 val = sym->implied.tri;
829 case mod: return "m";
830 case yes: return "y";
846 const char *sym_get_string_value(struct symbol *sym)
853 val = sym_get_tristate_value(sym);
866 return (const char *)sym->curr.val;
869 bool sym_is_changeable(const struct symbol *sym)
871 return !sym_is_choice(sym) && sym->visible > sym->rev_dep.tri;
874 bool sym_is_choice_value(const struct symbol *sym)
876 return !list_empty(&sym->choice_link);
879 HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE);
881 struct symbol *sym_lookup(const char *name, int flags)
883 struct symbol *symbol;
888 if (name[0] && !name[1]) {
890 case 'y': return &symbol_yes;
891 case 'm': return &symbol_mod;
892 case 'n': return &symbol_no;
895 hash = strhash(name);
897 hash_for_each_possible(sym_hashtable, symbol, node, hash) {
899 !strcmp(symbol->name, name) &&
900 (flags ? symbol->flags & flags
901 : !(symbol->flags & SYMBOL_CONST)))
904 new_name = xstrdup(name);
910 symbol = xmalloc(sizeof(*symbol));
911 memset(symbol, 0, sizeof(*symbol));
912 symbol->name = new_name;
913 symbol->type = S_UNKNOWN;
914 symbol->flags = flags;
915 INIT_LIST_HEAD(&symbol->menus);
916 INIT_LIST_HEAD(&symbol->choice_link);
918 hash_add(sym_hashtable, &symbol->node, hash);
923 struct symbol *sym_find(const char *name)
925 struct symbol *symbol = NULL;
931 if (name[0] && !name[1]) {
933 case 'y': return &symbol_yes;
934 case 'm': return &symbol_mod;
935 case 'n': return &symbol_no;
938 hash = strhash(name);
940 hash_for_each_possible(sym_hashtable, symbol, node, hash) {
942 !strcmp(symbol->name, name) &&
943 !(symbol->flags & SYMBOL_CONST))
955 /* Compare matched symbols as thus:
956 * - first, symbols that match exactly
957 * - then, alphabetical sort
959 static int sym_rel_comp(const void *sym1, const void *sym2)
961 const struct sym_match *s1 = sym1;
962 const struct sym_match *s2 = sym2;
966 * - if matched length on symbol s1 is the length of that symbol,
967 * then this symbol should come first;
968 * - if matched length on symbol s2 is the length of that symbol,
969 * then this symbol should come first.
970 * Note: since the search can be a regexp, both symbols may match
971 * exactly; if this is the case, we can't decide which comes first,
972 * and we fallback to sorting alphabetically.
974 exact1 = (s1->eo - s1->so) == strlen(s1->sym->name);
975 exact2 = (s2->eo - s2->so) == strlen(s2->sym->name);
976 if (exact1 && !exact2)
978 if (!exact1 && exact2)
981 /* As a fallback, sort symbols alphabetically */
982 return strcmp(s1->sym->name, s2->sym->name);
985 struct symbol **sym_re_search(const char *pattern)
987 struct symbol *sym, **sym_arr = NULL;
988 struct sym_match *sym_match_arr = NULL;
995 if (strlen(pattern) == 0)
997 if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE))
1000 for_all_symbols(sym) {
1001 if (sym->flags & SYMBOL_CONST || !sym->name)
1003 if (regexec(&re, sym->name, 1, match, 0))
1008 tmp = realloc(sym_match_arr, size * sizeof(struct sym_match));
1010 goto sym_re_search_free;
1011 sym_match_arr = tmp;
1013 sym_calc_value(sym);
1014 /* As regexec returned 0, we know we have a match, so
1015 * we can use match[0].rm_[se]o without further checks
1017 sym_match_arr[cnt].so = match[0].rm_so;
1018 sym_match_arr[cnt].eo = match[0].rm_eo;
1019 sym_match_arr[cnt++].sym = sym;
1021 if (sym_match_arr) {
1022 qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp);
1023 sym_arr = malloc((cnt+1) * sizeof(struct symbol *));
1025 goto sym_re_search_free;
1026 for (i = 0; i < cnt; i++)
1027 sym_arr[i] = sym_match_arr[i].sym;
1028 sym_arr[cnt] = NULL;
1031 /* sym_match_arr can be NULL if no match, but free(NULL) is OK */
1032 free(sym_match_arr);
1039 * When we check for recursive dependencies we use a stack to save
1040 * current state so we can print out relevant info to user.
1041 * The entries are located on the call stack so no need to free memory.
1042 * Note insert() remove() must always match to properly clear the stack.
1044 static struct dep_stack {
1045 struct dep_stack *prev, *next;
1047 struct property *prop;
1051 static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
1053 memset(stack, 0, sizeof(*stack));
1055 check_top->next = stack;
1056 stack->prev = check_top;
1061 static void dep_stack_remove(void)
1063 check_top = check_top->prev;
1065 check_top->next = NULL;
1069 * Called when we have detected a recursive dependency.
1070 * check_top point to the top of the stact so we use
1071 * the ->prev pointer to locate the bottom of the stack.
1073 static void sym_check_print_recursive(struct symbol *last_sym)
1075 struct dep_stack *stack;
1076 struct symbol *sym, *next_sym;
1077 struct menu *choice;
1078 struct dep_stack cv_stack;
1079 enum prop_type type;
1081 choice = sym_get_choice_menu(last_sym);
1083 dep_stack_insert(&cv_stack, last_sym);
1084 last_sym = choice->sym;
1087 for (stack = check_top; stack != NULL; stack = stack->prev)
1088 if (stack->sym == last_sym)
1091 fprintf(stderr, "unexpected recursive dependency error\n");
1095 for (; stack; stack = stack->next) {
1097 next_sym = stack->next ? stack->next->sym : last_sym;
1098 type = stack->prop ? stack->prop->type : P_UNKNOWN;
1100 if (stack->sym == last_sym)
1101 fprintf(stderr, "error: recursive dependency detected!\n");
1103 if (sym_is_choice(next_sym)) {
1104 choice = list_first_entry(&next_sym->menus, struct menu, link);
1106 fprintf(stderr, "\tsymbol %s is part of choice block at %s:%d\n",
1107 sym->name ? sym->name : "<choice>",
1108 choice->filename, choice->lineno);
1109 } else if (stack->expr == &sym->dir_dep.expr) {
1110 fprintf(stderr, "\tsymbol %s depends on %s\n",
1111 sym->name ? sym->name : "<choice>",
1113 } else if (stack->expr == &sym->rev_dep.expr) {
1114 fprintf(stderr, "\tsymbol %s is selected by %s\n",
1115 sym->name, next_sym->name);
1116 } else if (stack->expr == &sym->implied.expr) {
1117 fprintf(stderr, "\tsymbol %s is implied by %s\n",
1118 sym->name, next_sym->name);
1119 } else if (stack->expr) {
1120 fprintf(stderr, "\tsymbol %s %s value contains %s\n",
1121 sym->name ? sym->name : "<choice>",
1122 prop_get_type_name(type),
1125 fprintf(stderr, "\tsymbol %s %s is visible depending on %s\n",
1126 sym->name ? sym->name : "<choice>",
1127 prop_get_type_name(type),
1133 "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n"
1134 "subsection \"Kconfig recursive dependency limitations\"\n"
1137 if (check_top == &cv_stack)
1141 static struct symbol *sym_check_expr_deps(const struct expr *e)
1150 sym = sym_check_expr_deps(e->left.expr);
1153 return sym_check_expr_deps(e->right.expr);
1155 return sym_check_expr_deps(e->left.expr);
1162 sym = sym_check_deps(e->left.sym);
1165 return sym_check_deps(e->right.sym);
1167 return sym_check_deps(e->left.sym);
1171 fprintf(stderr, "Oops! How to check %d?\n", e->type);
1175 /* return NULL when dependencies are OK */
1176 static struct symbol *sym_check_sym_deps(struct symbol *sym)
1178 struct symbol *sym2;
1179 struct property *prop;
1180 struct dep_stack stack;
1182 dep_stack_insert(&stack, sym);
1184 stack.expr = &sym->dir_dep.expr;
1185 sym2 = sym_check_expr_deps(sym->dir_dep.expr);
1189 stack.expr = &sym->rev_dep.expr;
1190 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
1194 stack.expr = &sym->implied.expr;
1195 sym2 = sym_check_expr_deps(sym->implied.expr);
1201 for (prop = sym->prop; prop; prop = prop->next) {
1202 if (prop->type == P_SELECT || prop->type == P_IMPLY)
1205 sym2 = sym_check_expr_deps(prop->visible.expr);
1208 if (prop->type != P_DEFAULT || sym_is_choice(sym))
1210 stack.expr = &prop->expr;
1211 sym2 = sym_check_expr_deps(prop->expr);
1223 static struct symbol *sym_check_choice_deps(struct symbol *choice)
1225 struct menu *choice_menu, *menu;
1226 struct symbol *sym2;
1227 struct dep_stack stack;
1229 dep_stack_insert(&stack, choice);
1231 choice_menu = list_first_entry(&choice->menus, struct menu, link);
1233 menu_for_each_sub_entry(menu, choice_menu) {
1235 menu->sym->flags |= SYMBOL_CHECK | SYMBOL_CHECKED;
1238 choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
1239 sym2 = sym_check_sym_deps(choice);
1240 choice->flags &= ~SYMBOL_CHECK;
1244 menu_for_each_sub_entry(menu, choice_menu) {
1247 sym2 = sym_check_sym_deps(menu->sym);
1252 menu_for_each_sub_entry(menu, choice_menu)
1254 menu->sym->flags &= ~SYMBOL_CHECK;
1257 struct menu *choice_menu2;
1259 choice_menu2 = sym_get_choice_menu(sym2);
1260 if (choice_menu2 == choice_menu)
1269 struct symbol *sym_check_deps(struct symbol *sym)
1271 struct menu *choice;
1272 struct symbol *sym2;
1274 if (sym->flags & SYMBOL_CHECK) {
1275 sym_check_print_recursive(sym);
1278 if (sym->flags & SYMBOL_CHECKED)
1281 choice = sym_get_choice_menu(sym);
1283 struct dep_stack stack;
1285 /* for choice groups start the check with main choice symbol */
1286 dep_stack_insert(&stack, sym);
1287 sym2 = sym_check_deps(choice->sym);
1289 } else if (sym_is_choice(sym)) {
1290 sym2 = sym_check_choice_deps(sym);
1292 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
1293 sym2 = sym_check_sym_deps(sym);
1294 sym->flags &= ~SYMBOL_CHECK;
1300 struct symbol *prop_get_symbol(const struct property *prop)
1302 if (prop->expr && prop->expr->type == E_SYMBOL)
1303 return prop->expr->left.sym;
1307 const char *prop_get_type_name(enum prop_type type)