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 dependency between choice members

A choice member must not depend on another member within the same choice
block.

Kconfig detects this, but the error message is not sensible.

[Test Code]

choice
prompt "choose"

config A
bool "A"
depends on B

config B
bool "B"

endchoice

[Result]

Kconfig:1:error: recursive dependency detected!
Kconfig:1: choice <choice> contains symbol A
Kconfig:4: symbol A is part of choice B
Kconfig:8: symbol B is part of choice <choice>
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

The phrase "part of choice B" is weird because B is not a choice block,
but a choice member.

To determine whether the current symbol is a part of a choice block,
sym_is_choice(next_sym) must be checked.

This commit improves the error message to:

Kconfig:1:error: recursive dependency detected!
Kconfig:1: choice <choice> contains symbol A
Kconfig:4: symbol A symbol is visible depending on B
Kconfig:8: symbol B 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 -1
+1 -1
scripts/kconfig/symbol.c
··· 1111 1111 menu->filename, menu->lineno, 1112 1112 sym->name ? sym->name : "<choice>", 1113 1113 next_sym->name ? next_sym->name : "<choice>"); 1114 - } else if (sym_is_choice_value(sym)) { 1114 + } else if (sym_is_choice(next_sym)) { 1115 1115 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1116 1116 menu->filename, menu->lineno, 1117 1117 sym->name ? sym->name : "<choice>",