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: 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 <masahiroy@kernel.org>

+1 -6
+1 -6
scripts/kconfig/symbol.c
··· 1106 1106 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1107 1107 prop->filename, prop->lineno); 1108 1108 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)) { 1115 1110 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1116 1111 menu->filename, menu->lineno, 1117 1112 sym->name ? sym->name : "<choice>",