Skip to content

Commit eb4cf5a

Browse files
lacombarmichal42
authored andcommitted
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 <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Broken-by: Arnaud Lacombe <[email protected]> Reported-by: Randy Dunlap <[email protected]> Reported-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Randy Dunlap <[email protected]> Signed-off-by: Arnaud Lacombe <[email protected]> Signed-off-by: Michal Marek <[email protected]>
1 parent a1e8065 commit eb4cf5a

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

scripts/kconfig/confdata.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
487487
static void
488488
header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
489489
{
490-
const char *suffix = "";
491490

492491
switch (sym->type) {
493492
case S_BOOLEAN:
494-
case S_TRISTATE:
493+
case S_TRISTATE: {
494+
const char *suffix = "";
495+
495496
switch (*value) {
496497
case 'n':
497498
return;
498499
case 'm':
499500
suffix = "_MODULE";
500-
/* FALLTHROUGH */
501+
/* fall through */
501502
default:
502503
value = "1";
503504
}
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);
504522
break;
505523
default:
506524
break;
507525
}
508526

509-
fprintf(fp, "#define %s%s%s %s\n",
510-
CONFIG_, sym->name, suffix, value);
511527
}
512528

513529
static void

0 commit comments

Comments
 (0)