Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Jan 2011 16:28:17 +0000 (08:28 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Jan 2011 16:28:17 +0000 (08:28 -0800)
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  nconf: handle comment entries within choice/endchoice
  kconfig: fix warning
  kconfig: Make expr_copy() take a const argument
  kconfig: simplify select-with-unmet-direct-dependency warning
  kconfig: add more S_INT and S_HEX consistency checks
  kconfig: fix `zconfdebug' extern declaration
  kconfig/conf: merge duplicate switch's case
  kconfig: fix typos
  kbuild/gconf: add dummy inline for bind_textdomain_codeset()
  kbuild/nconf: fix spaces damage
  kconfig: nuke second argument of conf_write_symbol()
  kconfig: do not define AUTOCONF_INCLUDED
  kconfig: the day kconfig warns about "select"-abuse has come

1  2 
scripts/kconfig/expr.h
scripts/kconfig/lkc.h
scripts/kconfig/menu.c
scripts/kconfig/symbol.c

diff --combined scripts/kconfig/expr.h
@@@ -164,7 -164,6 +164,7 @@@ struct menu 
        struct menu *list;
        struct symbol *sym;
        struct property *prompt;
 +      struct expr *visibility;
        struct expr *dep;
        unsigned int flags;
        char *help;
@@@ -192,7 -191,7 +192,7 @@@ struct expr *expr_alloc_two(enum expr_t
  struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
  struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
  struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
- struct expr *expr_copy(struct expr *org);
+ struct expr *expr_copy(const struct expr *org);
  void expr_free(struct expr *e);
  int expr_eq(struct expr *e1, struct expr *e2);
  void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
@@@ -207,6 -206,7 +207,7 @@@ struct expr *expr_extract_eq_and(struc
  struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
  void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
  struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
+ struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
  
  void expr_fprint(struct expr *e, FILE *out);
  struct gstr; /* forward */
diff --combined scripts/kconfig/lkc.h
@@@ -14,6 -14,7 +14,7 @@@
  static inline const char *gettext(const char *txt) { return txt; }
  static inline void textdomain(const char *domainname) {}
  static inline void bindtextdomain(const char *name, const char *dir) {}
+ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
  #endif
  
  #ifdef __cplusplus
@@@ -67,10 -68,12 +68,12 @@@ struct kconf_id 
        enum symbol_type stype;
  };
  
+ #ifdef YYDEBUG
+ extern int zconfdebug;
+ #endif
  int zconfparse(void);
  void zconfdump(FILE *out);
- extern int zconfdebug;
  void zconf_starthelp(void);
  FILE *zconf_fopen(const char *name);
  void zconf_initscan(const char *name);
@@@ -107,7 -110,6 +110,7 @@@ void menu_end_menu(void)
  void menu_add_entry(struct symbol *sym);
  void menu_end_entry(void);
  void menu_add_dep(struct expr *dep);
 +void menu_add_visibility(struct expr *dep);
  struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
  struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
  void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
diff --combined scripts/kconfig/menu.c
@@@ -140,20 -140,6 +140,20 @@@ struct property *menu_add_prop(enum pro
                }
                if (current_entry->prompt && current_entry != &rootmenu)
                        prop_warn(prop, "prompt redefined");
 +
 +              /* Apply all upper menus' visibilities to actual prompts. */
 +              if(type == P_PROMPT) {
 +                      struct menu *menu = current_entry;
 +
 +                      while ((menu = menu->parent) != NULL) {
 +                              if (!menu->visibility)
 +                                      continue;
 +                              prop->visible.expr
 +                                      = expr_alloc_and(prop->visible.expr,
 +                                                       menu->visibility);
 +                      }
 +              }
 +
                current_entry->prompt = prop;
        }
        prop->text = prompt;
@@@ -166,12 -152,6 +166,12 @@@ struct property *menu_add_prompt(enum p
        return menu_add_prop(type, prompt, NULL, dep);
  }
  
 +void menu_add_visibility(struct expr *expr)
 +{
 +      current_entry->visibility = expr_alloc_and(current_entry->visibility,
 +          expr);
 +}
 +
  void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
  {
        menu_add_prop(type, NULL, expr, dep);
@@@ -203,7 -183,7 +203,7 @@@ void menu_add_option(int token, char *a
        }
  }
  
- static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
+ static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
  {
        return sym2->type == S_INT || sym2->type == S_HEX ||
               (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
@@@ -221,6 -201,15 +221,15 @@@ static void sym_check_prop(struct symbo
                                prop_warn(prop,
                                    "default for config symbol '%s'"
                                    " must be a single symbol", sym->name);
+                       if (prop->expr->type != E_SYMBOL)
+                               break;
+                       sym2 = prop_get_symbol(prop);
+                       if (sym->type == S_HEX || sym->type == S_INT) {
+                               if (!menu_validate_number(sym, sym2))
+                                       prop_warn(prop,
+                                           "'%s': number is invalid",
+                                           sym->name);
+                       }
                        break;
                case P_SELECT:
                        sym2 = prop_get_symbol(prop);
                        if (sym->type != S_INT && sym->type != S_HEX)
                                prop_warn(prop, "range is only allowed "
                                                "for int or hex symbols");
-                       if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
-                           !menu_range_valid_sym(sym, prop->expr->right.sym))
+                       if (!menu_validate_number(sym, prop->expr->left.sym) ||
+                           !menu_validate_number(sym, prop->expr->right.sym))
                                prop_warn(prop, "range is invalid");
                        break;
                default:
@@@ -430,11 -419,6 +439,11 @@@ bool menu_is_visible(struct menu *menu
        if (!menu->prompt)
                return false;
  
 +      if (menu->visibility) {
 +              if (expr_calc_value(menu->visibility) == no)
 +                      return no;
 +      }
 +
        sym = menu->sym;
        if (sym) {
                sym_calc_value(sym);
diff --combined scripts/kconfig/symbol.c
@@@ -351,12 -351,16 +351,16 @@@ void sym_calc_value(struct symbol *sym
                        }
                calc_newval:
                        if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
+                               struct expr *e;
+                               e = expr_simplify_unmet_dep(sym->rev_dep.expr,
+                                   sym->dir_dep.expr);
                                fprintf(stderr, "warning: (");
-                               expr_fprint(sym->rev_dep.expr, stderr);
+                               expr_fprint(e, stderr);
                                fprintf(stderr, ") selects %s which has unmet direct dependencies (",
                                        sym->name);
                                expr_fprint(sym->dir_dep.expr, stderr);
                                fprintf(stderr, ")\n");
+                               expr_free(e);
                        }
                        newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
                }
@@@ -686,7 -690,7 +690,7 @@@ const char *sym_get_string_default(stru
                switch (sym->type) {
                case S_BOOLEAN:
                case S_TRISTATE:
-                       /* The visibility imay limit the value from yes => mod */
+                       /* The visibility may limit the value from yes => mod */
                        val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
                        break;
                default:
@@@ -875,7 -879,7 +879,7 @@@ const char *sym_expand_string_value(con
                        symval = sym_get_string_value(sym);
                }
  
 -              newlen = strlen(res) + strlen(symval) + strlen(src);
 +              newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
                if (newlen > reslen) {
                        reslen = newlen;
                        res = realloc(res, reslen);