@@ -778,6 +778,28 @@ out:
return res;
}
+static void conf_write_function_autoconf(FILE *out, char* conf, char* name, int val)
+{
+ char c;
+ char *tmp, *d;
+
+ *d = strdup(conf);
+ tmp = d;
+ while ((c = *conf++)) {
+ *d++ = tolower(c);
+ }
+ fprintf(out, "#define is_%s", tmp);
+ free(tmp);
+
+ d = strdup(name);
+ tmp = d;
+ while ((c = *name++)) {
+ *d++ = tolower(c);
+ }
+ fprintf(out, "%s() %d\n", tmp, val);
+ free(tmp);
+}
+
int conf_write_autoconf(void)
{
struct symbol *sym;
@@ -786,6 +808,7 @@ int conf_write_autoconf(void)
FILE *out, *tristate, *out_h;
time_t now;
int i;
+ int fct_val;
sym_clear_all_valid();
@@ -829,6 +852,7 @@ int conf_write_autoconf(void)
rootmenu.prompt->text, ctime(&now));
for_all_symbols(i, sym) {
+ fct_val = 1;
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
continue;
@@ -842,6 +866,7 @@ int conf_write_autoconf(void)
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
case no:
+ fct_val = 0;
break;
case mod:
fprintf(tristate, "%s%s=M\n",
@@ -874,8 +899,10 @@ int conf_write_autoconf(void)
CONFIG_, sym->name, str);
break;
default:
+ fct_val = 0;
break;
}
+ conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
}
fclose(out);
fclose(tristate);
this will allow to use to use if(is_config_xxx()) in the code instead of #ifdef CONFIG_xxx and now let the compiler remove the non usefull code and not the pre-processor as done in the mach-types for arm as exmaple Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- scripts/kconfig/confdata.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)