aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2007-05-06 03:20:10 -0400
committerSam Ravnborg <sam@ravnborg.org>2007-05-06 03:20:10 -0400
commit5447d34b080a1e3e312b05a91e87eff4710a1152 (patch)
tree0e232d4f5fa7116fb48ca39ce1dc8dcbdeec0187 /scripts
parent04c58f8196b386948abf68128605de3d2db3c6ba (diff)
kconfig: error out if recursive dependencies are found
Sample: config FOO bool "This is foo" depends on BAR config BAR bool "This is bar" depends on FOO This will result in following error message: error: found recursive dependency: FOO -> BAR -> FOO And will then exit with exit code equal 1 so make will stop. Inspired by patch from: Adrian Bunk <bunk@stusta.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Adrian Bunk <bunk@stusta.de> Cc: Roman Zippel <zippel@linux-m68k.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/symbol.c13
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped6
-rw-r--r--scripts/kconfig/zconf.y6
3 files changed, 13 insertions, 12 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 8f06c474d800..c35dcc5d6189 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -786,13 +786,15 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
786 return NULL; 786 return NULL;
787} 787}
788 788
789/* return NULL when dependencies are OK */
789struct symbol *sym_check_deps(struct symbol *sym) 790struct symbol *sym_check_deps(struct symbol *sym)
790{ 791{
791 struct symbol *sym2; 792 struct symbol *sym2;
792 struct property *prop; 793 struct property *prop;
793 794
794 if (sym->flags & SYMBOL_CHECK) { 795 if (sym->flags & SYMBOL_CHECK) {
795 printf("Warning! Found recursive dependency: %s", sym->name); 796 fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
797 sym->prop->file->name, sym->prop->lineno, sym->name);
796 return sym; 798 return sym;
797 } 799 }
798 if (sym->flags & SYMBOL_CHECKED) 800 if (sym->flags & SYMBOL_CHECKED)
@@ -816,13 +818,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
816 goto out; 818 goto out;
817 } 819 }
818out: 820out:
819 if (sym2) { 821 if (sym2)
820 printf(" %s", sym->name); 822 fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": "");
821 if (sym2 == sym) {
822 printf("\n");
823 sym2 = NULL;
824 }
825 }
826 sym->flags &= ~SYMBOL_CHECK; 823 sym->flags &= ~SYMBOL_CHECK;
827 return sym2; 824 return sym2;
828} 825}
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index d777fe85627f..9a06b6771eee 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -2132,9 +2132,11 @@ void conf_parse(const char *name)
2132 } 2132 }
2133 menu_finalize(&rootmenu); 2133 menu_finalize(&rootmenu);
2134 for_all_symbols(i, sym) { 2134 for_all_symbols(i, sym) {
2135 sym_check_deps(sym); 2135 if (sym_check_deps(sym))
2136 zconfnerrs++;
2136 } 2137 }
2137 2138 if (zconfnerrs)
2139 exit(1);
2138 sym_set_change_count(1); 2140 sym_set_change_count(1);
2139} 2141}
2140 2142
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 04a5864c03b1..92eb02bdf9c5 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -501,9 +501,11 @@ void conf_parse(const char *name)
501 } 501 }
502 menu_finalize(&rootmenu); 502 menu_finalize(&rootmenu);
503 for_all_symbols(i, sym) { 503 for_all_symbols(i, sym) {
504 sym_check_deps(sym); 504 if (sym_check_deps(sym))
505 zconfnerrs++;
505 } 506 }
506 507 if (zconfnerrs)
508 exit(1);
507 sym_set_change_count(1); 509 sym_set_change_count(1);
508} 510}
509 511