aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2011-07-14 15:31:07 -0400
committerMichal Marek <mmarek@suse.cz>2011-07-18 10:29:29 -0400
commiteb4cf5a642f6430cffff7ba5d8d9bd46ea409281 (patch)
tree6cb05ea1abb119903315143cd32c1a86340606c5 /scripts
parenta1e806550e566e987e06561873ab8276ee54d130 (diff)
kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
The specialized printer for headers (espectially autoconf.h) is missing fixup code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such missing prefix, this code is needed. Fix this. In the same time, fix some nits in `header_print_symbol()'. Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Broken-by: Arnaud Lacombe <lacombar@gmail.com> Reported-by: Randy Dunlap <rdunlap@xenotime.net> Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index be6952c7fb29..df629ecb4fdf 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
487static void 487static void
488header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) 488header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
489{ 489{
490 const char *suffix = "";
491 490
492 switch (sym->type) { 491 switch (sym->type) {
493 case S_BOOLEAN: 492 case S_BOOLEAN:
494 case S_TRISTATE: 493 case S_TRISTATE: {
494 const char *suffix = "";
495
495 switch (*value) { 496 switch (*value) {
496 case 'n': 497 case 'n':
497 return; 498 return;
498 case 'm': 499 case 'm':
499 suffix = "_MODULE"; 500 suffix = "_MODULE";
500 /* FALLTHROUGH */ 501 /* fall through */
501 default: 502 default:
502 value = "1"; 503 value = "1";
503 } 504 }
505 fprintf(fp, "#define %s%s%s %s\n",
506 CONFIG_, sym->name, suffix, value);
507 break;
508 }
509 case S_HEX: {
510 const char *prefix = "";
511
512 if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
513 prefix = "0x";
514 fprintf(fp, "#define %s%s %s%s\n",
515 CONFIG_, sym->name, prefix, value);
516 break;
517 }
518 case S_STRING:
519 case S_INT:
520 fprintf(fp, "#define %s%s %s\n",
521 CONFIG_, sym->name, value);
504 break; 522 break;
505 default: 523 default:
506 break; 524 break;
507 } 525 }
508 526
509 fprintf(fp, "#define %s%s%s %s\n",
510 CONFIG_, sym->name, suffix, value);
511} 527}
512 528
513static void 529static void