Commit cc25cfc5 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: print recursive dependency errors in the parsed order

for_all_symbols() iterates in the symbol hash table. The order of
iteration depends on the hash table implementation.

If you use it for printing errors, they are shown in random order.

For example, the order of following test input and the corresponding
error do not match:
 - scripts/kconfig/tests/err_recursive_dep/Kconfig
 - scripts/kconfig/tests/err_recursive_dep/expected_stderr
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 7d5f52a4
...@@ -473,8 +473,7 @@ assign_val: ...@@ -473,8 +473,7 @@ assign_val:
void conf_parse(const char *name) void conf_parse(const char *name)
{ {
struct symbol *sym; struct menu *menu;
int i;
autoconf_cmd = str_new(); autoconf_cmd = str_new();
...@@ -517,10 +516,23 @@ void conf_parse(const char *name) ...@@ -517,10 +516,23 @@ void conf_parse(const char *name)
} }
menu_finalize(&rootmenu); menu_finalize(&rootmenu);
for_all_symbols(i, sym) {
if (sym_check_deps(sym)) menu = &rootmenu;
while (menu) {
if (menu->sym && sym_check_deps(menu->sym))
yynerrs++; yynerrs++;
if (menu->list) {
menu = menu->list;
continue;
}
while (!menu->next && menu->parent)
menu = menu->parent;
menu = menu->next;
} }
if (yynerrs) if (yynerrs)
exit(1); exit(1);
conf_set_changed(true); conf_set_changed(true);
......
Kconfig:11:error: recursive dependency detected! Kconfig:5:error: recursive dependency detected!
Kconfig:11: symbol B is selected by B Kconfig:5: symbol A depends on A
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
Kconfig:5:error: recursive dependency detected! Kconfig:11:error: recursive dependency detected!
Kconfig:5: symbol A depends on A Kconfig:11: symbol B is selected by B
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
...@@ -14,9 +14,9 @@ Kconfig:21: symbol C2 depends on C1 ...@@ -14,9 +14,9 @@ Kconfig:21: symbol C2 depends on C1
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
Kconfig:32:error: recursive dependency detected! Kconfig:27:error: recursive dependency detected!
Kconfig:32: symbol D2 is selected by D1
Kconfig:27: symbol D1 depends on D2 Kconfig:27: symbol D1 depends on D2
Kconfig:32: symbol D2 is selected by D1
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
...@@ -26,13 +26,13 @@ Kconfig:42: symbol E2 is implied by E1 ...@@ -26,13 +26,13 @@ Kconfig:42: symbol E2 is implied by E1
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
Kconfig:60:error: recursive dependency detected! Kconfig:49:error: recursive dependency detected!
Kconfig:60: symbol G depends on G Kconfig:49: symbol F1 default value contains F2
Kconfig:51: symbol F2 depends on F1
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
Kconfig:51:error: recursive dependency detected! Kconfig:60:error: recursive dependency detected!
Kconfig:51: symbol F2 depends on F1 Kconfig:60: symbol G depends on G
Kconfig:49: symbol F1 default value contains F2
For a resolution refer to Documentation/kbuild/kconfig-language.rst For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations" subsection "Kconfig recursive dependency limitations"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment