Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5447d34b080a1e3e312b05a91e87eff4710a1152
Commit:     5447d34b080a1e3e312b05a91e87eff4710a1152
Parent:     04c58f8196b386948abf68128605de3d2db3c6ba
Author:     Sam Ravnborg <[EMAIL PROTECTED]>
AuthorDate: Sun May 6 09:20:10 2007 +0200
Committer:  Sam Ravnborg <[EMAIL PROTECTED]>
CommitDate: Sun May 6 09:20:10 2007 +0200

    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 <[EMAIL PROTECTED]>
    
    Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]>
    Cc: Adrian Bunk <[EMAIL PROTECTED]>
    Cc: Roman Zippel <[EMAIL PROTECTED]>
---
 scripts/kconfig/symbol.c            |   13 +++++--------
 scripts/kconfig/zconf.tab.c_shipped |    6 ++++--
 scripts/kconfig/zconf.y             |    6 ++++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 8f06c47..c35dcc5 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)
        return NULL;
 }
 
+/* return NULL when dependencies are OK */
 struct symbol *sym_check_deps(struct symbol *sym)
 {
        struct symbol *sym2;
        struct property *prop;
 
        if (sym->flags & SYMBOL_CHECK) {
-               printf("Warning! Found recursive dependency: %s", sym->name);
+               fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
+                       sym->prop->file->name, sym->prop->lineno, sym->name);
                return sym;
        }
        if (sym->flags & SYMBOL_CHECKED)
@@ -816,13 +818,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
                        goto out;
        }
 out:
-       if (sym2) {
-               printf(" %s", sym->name);
-               if (sym2 == sym) {
-                       printf("\n");
-                       sym2 = NULL;
-               }
-       }
+       if (sym2)
+               fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": "");
        sym->flags &= ~SYMBOL_CHECK;
        return sym2;
 }
diff --git a/scripts/kconfig/zconf.tab.c_shipped 
b/scripts/kconfig/zconf.tab.c_shipped
index d777fe8..9a06b67 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)
        }
        menu_finalize(&rootmenu);
        for_all_symbols(i, sym) {
-               sym_check_deps(sym);
+               if (sym_check_deps(sym))
+                       zconfnerrs++;
         }
-
+       if (zconfnerrs)
+               exit(1);
        sym_set_change_count(1);
 }
 
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 04a5864..92eb02b 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -501,9 +501,11 @@ void conf_parse(const char *name)
        }
        menu_finalize(&rootmenu);
        for_all_symbols(i, sym) {
-               sym_check_deps(sym);
+               if (sym_check_deps(sym))
+                       zconfnerrs++;
         }
-
+       if (zconfnerrs)
+               exit(1);
        sym_set_change_count(1);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to