MCPcopy Create free account
hub / github.com/Entware/Entware / sym_check_print_recursive

Function sym_check_print_recursive

scripts/config/symbol.c:975–1062  ·  view source on GitHub ↗

* Called when we have detected a recursive dependency. * check_top point to the top of the stact so we use * the ->prev pointer to locate the bottom of the stack. */

Source from the content-addressed store, hash-verified

973 * the ->prev pointer to locate the bottom of the stack.
974 */
975static void sym_check_print_recursive(struct symbol *last_sym)
976{
977 struct dep_stack *stack;
978 struct symbol *sym, *next_sym;
979 struct menu *menu = NULL;
980 struct property *prop;
981 struct dep_stack cv_stack;
982
983 if (sym_is_choice_value(last_sym)) {
984 dep_stack_insert(&cv_stack, last_sym);
985 last_sym = prop_get_symbol(sym_get_choice_prop(last_sym));
986 }
987
988 for (stack = check_top; stack != NULL; stack = stack->prev)
989 if (stack->sym == last_sym)
990 break;
991 if (!stack) {
992 fprintf(stderr, "unexpected recursive dependency error\n");
993 return;
994 }
995
996 for (; stack; stack = stack->next) {
997 sym = stack->sym;
998 next_sym = stack->next ? stack->next->sym : last_sym;
999 prop = stack->prop;
1000 if (prop == NULL)
1001 prop = stack->sym->prop;
1002
1003 /* for choice values find the menu entry (used below) */
1004 if (sym_is_choice(sym) || sym_is_choice_value(sym)) {
1005 for (prop = sym->prop; prop; prop = prop->next) {
1006 menu = prop->menu;
1007 if (prop->menu)
1008 break;
1009 }
1010 }
1011 if (stack->sym == last_sym)
1012 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1013 prop->file->name, prop->lineno);
1014
1015 if (sym_is_choice(sym)) {
1016 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1017 menu->file->name, menu->lineno,
1018 sym->name ? sym->name : "<choice>",
1019 next_sym->name ? next_sym->name : "<choice>");
1020 } else if (sym_is_choice_value(sym)) {
1021 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
1022 menu->file->name, menu->lineno,
1023 sym->name ? sym->name : "<choice>",
1024 next_sym->name ? next_sym->name : "<choice>");
1025 } else if (stack->expr == &sym->dir_dep.expr) {
1026 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
1027 prop->file->name, prop->lineno,
1028 sym->name ? sym->name : "<choice>",
1029 next_sym->name ? next_sym->name : "<choice>");
1030 } else if (stack->expr == &sym->rev_dep.expr) {
1031 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
1032 prop->file->name, prop->lineno,

Callers 1

sym_check_depsFunction · 0.85

Calls 7

sym_is_choice_valueFunction · 0.85
dep_stack_insertFunction · 0.85
prop_get_symbolFunction · 0.85
sym_get_choice_propFunction · 0.85
sym_is_choiceFunction · 0.85
prop_get_type_nameFunction · 0.85
dep_stack_removeFunction · 0.85

Tested by

no test coverage detected