aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2011-08-16 01:20:20 -0400
committerArnaud Lacombe <lacombar@gmail.com>2011-08-29 20:19:48 -0400
commit953742c8fe8ac45be453fee959d7be40cd89f920 (patch)
tree4a46d15be1047d0f03050994ae41a4a006fe474c /scripts/kconfig/confdata.c
parent322a8b034003c0d46d39af85bf24fee27b902f48 (diff)
kconfig: fix __enabled_ macros definition for invisible and un-selected symbols
__enabled_<sym-name> are only generated on visible or selected entries, do not reflect the purpose of its introduction. Fix this by always generating these entries for named symbol. Reported-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 59b667cae5f3..5a58965d8800 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -503,17 +503,6 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
503 fprintf(fp, "#define %s%s%s 1\n", 503 fprintf(fp, "#define %s%s%s 1\n",
504 CONFIG_, sym->name, suffix); 504 CONFIG_, sym->name, suffix);
505 } 505 }
506 /*
507 * Generate the __enabled_CONFIG_* and
508 * __enabled_CONFIG_*_MODULE macros for use by the
509 * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
510 * generated even for booleans so that the IS_ENABLED() macro
511 * works.
512 */
513 fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
514 sym->name, (*value == 'y'));
515 fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
516 sym->name, (*value == 'm'));
517 break; 506 break;
518 } 507 }
519 case S_HEX: { 508 case S_HEX: {
@@ -565,6 +554,35 @@ static struct conf_printer header_printer_cb =
565}; 554};
566 555
567/* 556/*
557 * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for
558 * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
559 * generated even for booleans so that the IS_ENABLED() macro works.
560 */
561static void
562header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
563{
564
565 switch (sym->type) {
566 case S_BOOLEAN:
567 case S_TRISTATE: {
568 fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
569 sym->name, (*value == 'y'));
570 fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
571 sym->name, (*value == 'm'));
572 break;
573 }
574 default:
575 break;
576 }
577}
578
579static struct conf_printer header__enabled_printer_cb =
580{
581 .print_symbol = header_print__enabled_symbol,
582 .print_comment = header_print_comment,
583};
584
585/*
568 * Tristate printer 586 * Tristate printer
569 * 587 *
570 * This printer is used when generating the `include/config/tristate.conf' file. 588 * This printer is used when generating the `include/config/tristate.conf' file.
@@ -945,11 +963,16 @@ int conf_write_autoconf(void)
945 conf_write_heading(out_h, &header_printer_cb, NULL); 963 conf_write_heading(out_h, &header_printer_cb, NULL);
946 964
947 for_all_symbols(i, sym) { 965 for_all_symbols(i, sym) {
966 if (!sym->name)
967 continue;
968
948 sym_calc_value(sym); 969 sym_calc_value(sym);
949 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 970
971 conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL);
972
973 if (!(sym->flags & SYMBOL_WRITE))
950 continue; 974 continue;
951 975
952 /* write symbol to auto.conf, tristate and header files */
953 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); 976 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
954 977
955 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); 978 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);