Skip to content

Commit d67624d

Browse files
committed
kconfig: improve error message for recursive dependency in choice
Kconfig detects recursive dependencies in a choice block, but the error message is unclear. [Test Code] choice prompt "choose" depends on A config A bool "A" config B bool "B" endchoice [Result] Kconfig:1:error: recursive dependency detected! Kconfig:1: choice <choice> contains symbol A Kconfig:5: symbol A is part of choice <choice> For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" The phrase "contains symbol A" does not accurately describe the problem. The issue is that the choice depends on A, which is a member of itself. The first if-block does not print a sensible message. Remove it. This commit improves the error message to: Kconfig:1:error: recursive dependency detected! Kconfig:1: symbol <choice> symbol is visible depending on A Kconfig:5: symbol A is part of choice <choice> For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 1a7d0ea commit d67624d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

scripts/kconfig/symbol.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,12 +1106,7 @@ static void sym_check_print_recursive(struct symbol *last_sym)
11061106
fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
11071107
prop->filename, prop->lineno);
11081108

1109-
if (sym_is_choice(sym)) {
1110-
fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1111-
menu->filename, menu->lineno,
1112-
sym->name ? sym->name : "<choice>",
1113-
next_sym->name ? next_sym->name : "<choice>");
1114-
} else if (sym_is_choice(next_sym)) {
1109+
if (sym_is_choice(next_sym)) {
11151110
fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
11161111
menu->filename, menu->lineno,
11171112
sym->name ? sym->name : "<choice>",

0 commit comments

Comments
 (0)