From f4b15f8ac27ce0913cb4dca0b0e26f1aaf30025e Mon Sep 17 00:00:00 2001 From: Arnaud Lacombe Date: Thu, 23 Jun 2011 15:11:24 -0400 Subject: [PATCH] allyesrandchoiceconfig --- scripts/kconfig/Makefile | 2 +- scripts/kconfig/conf.c | 7 +++++++ scripts/kconfig/confdata.c | 14 +++++++++++--- scripts/kconfig/lkc.h | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index faa9a47..4eb9eac 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -98,7 +98,7 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig -allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf +allnoconfig allyesconfig allyesrandchoiceconfig allmodconfig alldefconfig randconfig: $(obj)/conf $< --$@ $(Kconfig) PHONY += listnewconfig oldnoconfig savedefconfig defconfig diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 006ad81..9b1c324 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -33,6 +33,7 @@ enum input_mode { savedefconfig, listnewconfig, oldnoconfig, + allyesrandchoiceconfig, } input_mode = oldaskconfig; char *defconfig_file; @@ -453,6 +454,7 @@ static struct option long_opts[] = { {"randconfig", no_argument, NULL, randconfig}, {"listnewconfig", no_argument, NULL, listnewconfig}, {"oldnoconfig", no_argument, NULL, oldnoconfig}, + {"allyesrandchoiceconfig", no_argument, NULL, allyesrandchoiceconfig}, {NULL, 0, NULL, 0} }; @@ -476,6 +478,7 @@ int main(int ac, char **av) case savedefconfig: defconfig_file = optarg; break; + case allyesrandchoiceconfig: case randconfig: { struct timeval now; @@ -579,6 +582,10 @@ int main(int ac, char **av) case allnoconfig: conf_set_all_new_symbols(def_no); break; + case allyesrandchoiceconfig: + conf_set_all_new_symbols(def_yes); + conf_set_all_new_choice_symbols(def_random); + break; case allyesconfig: conf_set_all_new_symbols(def_yes); break; diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2bafd9a..e96b95a 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -945,6 +945,7 @@ static void randomize_choice_values(struct symbol *csym) cnt = 0; expr_list_for_each_sym(prop->expr, e, sym) { + printf("%s %d %d\n", sym->name, def, cnt+1); if (def == cnt++) { sym->def[S_DEF_USER].tri = yes; csym->def[S_DEF_USER].val = sym; @@ -980,12 +981,14 @@ static void set_all_choice_values(struct symbol *csym) void conf_set_all_new_symbols(enum conf_def_mode mode) { - struct symbol *sym, *csym; + struct symbol *sym; int i, cnt; for_all_symbols(i, sym) { if (sym_has_value(sym)) continue; + if (sym_is_choice(sym)) + continue; switch (sym_get_type(sym)) { case S_BOOLEAN: case S_TRISTATE: @@ -1006,14 +1009,19 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) default: continue; } - if (!(sym_is_choice(sym) && mode == def_random)) - sym->flags |= SYMBOL_DEF_USER; + sym->flags |= SYMBOL_DEF_USER; break; default: break; } } +} + +void conf_set_all_new_choice_symbols(enum conf_def_mode mode) +{ + struct symbol *csym; + int i; sym_clear_all_valid(); diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index febf0c9..672c78f 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -91,6 +91,7 @@ char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); void conf_set_all_new_symbols(enum conf_def_mode mode); +void conf_set_all_new_choice_symbols(enum conf_def_mode mode); /* confdata.c and expr.c */ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) -- 1.7.3.4.574.g608b.dirty