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: refactor error messages in sym_check_print_recursive()

Improve the error messages and clean up redundant code.

[1] remove redundant next_sym->name checks

If 'next_sym' is a choice, the first 'if' block is executed. In the
subsequent 'else if' blocks, 'next_sym" is not a choice, hence
next_sym->name is not NULL.

[2] remove redundant sym->name checks

A choice is never selected or implied by anyone because it has no name
(it is syntactically impossible). If it is, sym->name is not NULL.

[3] Show the location of choice instead of "<choice>"

"part of choice <choice>" does not convey useful information. Since a
choice has no name, it is more informative to display the file name and
line number.

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

+9 -9
+9 -9
scripts/kconfig/symbol.c
··· 1107 1107 prop->filename, prop->lineno); 1108 1108 1109 1109 if (sym_is_choice(next_sym)) { 1110 - fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1110 + choice = list_first_entry(&next_sym->menus, struct menu, link); 1111 + 1112 + fprintf(stderr, "%s:%d:\tsymbol %s is part of choice block at %s:%d\n", 1111 1113 menu->filename, menu->lineno, 1112 1114 sym->name ? sym->name : "<choice>", 1113 - next_sym->name ? next_sym->name : "<choice>"); 1115 + choice->filename, choice->lineno); 1114 1116 } else if (stack->expr == &sym->dir_dep.expr) { 1115 1117 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", 1116 1118 prop->filename, prop->lineno, 1117 1119 sym->name ? sym->name : "<choice>", 1118 - next_sym->name ? next_sym->name : "<choice>"); 1120 + next_sym->name); 1119 1121 } else if (stack->expr == &sym->rev_dep.expr) { 1120 1122 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", 1121 1123 prop->filename, prop->lineno, 1122 - sym->name ? sym->name : "<choice>", 1123 - next_sym->name ? next_sym->name : "<choice>"); 1124 + sym->name, next_sym->name); 1124 1125 } else if (stack->expr == &sym->implied.expr) { 1125 1126 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n", 1126 1127 prop->filename, prop->lineno, 1127 - sym->name ? sym->name : "<choice>", 1128 - next_sym->name ? next_sym->name : "<choice>"); 1128 + sym->name, next_sym->name); 1129 1129 } else if (stack->expr) { 1130 1130 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1131 1131 prop->filename, prop->lineno, 1132 1132 sym->name ? sym->name : "<choice>", 1133 1133 prop_get_type_name(prop->type), 1134 - next_sym->name ? next_sym->name : "<choice>"); 1134 + next_sym->name); 1135 1135 } else { 1136 1136 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n", 1137 1137 prop->filename, prop->lineno, 1138 1138 sym->name ? sym->name : "<choice>", 1139 1139 prop_get_type_name(prop->type), 1140 - next_sym->name ? next_sym->name : "<choice>"); 1140 + next_sym->name); 1141 1141 } 1142 1142 } 1143 1143