Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6

* '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
This commit is contained in:
Linus Torvalds 2011-01-10 08:28:17 -08:00
commit f28b1c8aaa
9 changed files with 84 additions and 33 deletions

View file

@ -529,8 +529,6 @@ int main(int ac, char **av)
}
break;
case savedefconfig:
conf_read(NULL);
break;
case silentoldconfig:
case oldaskconfig:
case oldconfig:

View file

@ -440,12 +440,11 @@ static void conf_write_string(bool headerfile, const char *name,
fputs("\"\n", out);
}
static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
FILE *out, bool write_no)
static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
{
const char *str;
switch (type) {
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
@ -532,7 +531,7 @@ int conf_write_defconfig(const char *filename)
goto next_menu;
}
}
conf_write_symbol(sym, sym->type, out, true);
conf_write_symbol(sym, out, true);
}
next_menu:
if (menu->list != NULL) {
@ -561,7 +560,6 @@ int conf_write(const char *name)
const char *basename;
const char *str;
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
enum symbol_type type;
time_t now;
int use_timestamp = 1;
char *env;
@ -633,14 +631,8 @@ int conf_write(const char *name)
if (!(sym->flags & SYMBOL_WRITE))
goto next;
sym->flags &= ~SYMBOL_WRITE;
type = sym->type;
if (type == S_TRISTATE) {
sym_calc_value(modules_sym);
if (modules_sym->curr.tri == no)
type = S_BOOLEAN;
}
/* Write config symbol to file */
conf_write_symbol(sym, type, out, true);
conf_write_symbol(sym, out, true);
}
next:
@ -833,8 +825,7 @@ int conf_write_autoconf(void)
" * Automatically generated C config: don't edit\n"
" * %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n",
" */\n",
rootmenu.prompt->text, ctime(&now));
for_all_symbols(i, sym) {
@ -843,7 +834,7 @@ int conf_write_autoconf(void)
continue;
/* write symbol to config file */
conf_write_symbol(sym, sym->type, out, false);
conf_write_symbol(sym, out, false);
/* update autoconf and tristate files */
switch (sym->type) {
@ -946,7 +937,7 @@ static void randomize_choice_values(struct symbol *csym)
int cnt, def;
/*
* If choice is mod then we may have more items slected
* If choice is mod then we may have more items selected
* and if no then no-one.
* In both cases stop.
*/
@ -1042,10 +1033,10 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
/*
* We have different type of choice blocks.
* If curr.tri equal to mod then we can select several
* If curr.tri equals to mod then we can select several
* choice symbols in one block.
* In this case we do nothing.
* If curr.tri equal yes then only one symbol can be
* If curr.tri equals yes then only one symbol can be
* selected in a choice block and we set it to yes,
* and the rest to no.
*/

View file

@ -64,7 +64,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
}
struct expr *expr_copy(struct expr *org)
struct expr *expr_copy(const struct expr *org)
{
struct expr *e;
@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
#endif
}
static inline struct expr *
expr_get_leftmost_symbol(const struct expr *e)
{
if (e == NULL)
return NULL;
while (e->type != E_SYMBOL)
e = e->left.expr;
return expr_copy(e);
}
/*
* Given expression `e1' and `e2', returns the leaf of the longest
* sub-expression of `e1' not containing 'e2.
*/
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
{
struct expr *ret;
switch (e1->type) {
case E_OR:
return expr_alloc_and(
expr_simplify_unmet_dep(e1->left.expr, e2),
expr_simplify_unmet_dep(e1->right.expr, e2));
case E_AND: {
struct expr *e;
e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
e = expr_eliminate_dups(e);
ret = (!expr_eq(e, e1)) ? e1 : NULL;
expr_free(e);
break;
}
default:
ret = e1;
break;
}
return expr_get_leftmost_symbol(ret);
}
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
{
if (!e) {

View file

@ -192,7 +192,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
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 +207,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
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 */

View file

@ -14,6 +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 @@ 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);

View file

@ -203,7 +203,7 @@ void menu_add_option(int token, char *arg)
}
}
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 +221,15 @@ static void sym_check_prop(struct symbol *sym)
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);
@ -240,8 +249,8 @@ static void sym_check_prop(struct symbol *sym)
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:

View file

@ -248,7 +248,7 @@ search_help[] = N_(
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
"Examples: USB = > find all symbols containing USB\n"
"Examples: USB => find all symbols containing USB\n"
" ^USB => find all symbols starting with USB\n"
" USB$ => find all symbols ending with USB\n"
"\n");
@ -1266,9 +1266,13 @@ static void conf_choice(struct menu *menu)
if (child->sym == sym_get_choice_value(menu->sym))
item_make(child, ':', "<X> %s",
_(menu_get_prompt(child)));
else
else if (child->sym)
item_make(child, ':', " %s",
_(menu_get_prompt(child)));
else
item_make(child, ':', "*** %s ***",
_(menu_get_prompt(child)));
if (child->sym == active){
last_top_row = top_row(curses_menu);
selected_index = i;
@ -1334,7 +1338,7 @@ static void conf_choice(struct menu *menu)
break;
child = item_data();
if (!child || !menu_is_visible(child))
if (!child || !menu_is_visible(child) || !child->sym)
continue;
switch (res) {
case ' ':

View file

@ -351,12 +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 @@ const char *sym_get_string_default(struct symbol *sym)
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: