Skip to content

Commit

Permalink
kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lacombar authored and michal42 committed Jul 18, 2011
1 parent a1e8065 commit eb4cf5a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
static void
header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
{
const char *suffix = "";

switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
case S_TRISTATE: {
const char *suffix = "";

switch (*value) {
case 'n':
return;
case 'm':
suffix = "_MODULE";
/* FALLTHROUGH */
/* fall through */
default:
value = "1";
}
fprintf(fp, "#define %s%s%s %s\n",
CONFIG_, sym->name, suffix, value);
break;
}
case S_HEX: {
const char *prefix = "";

if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
prefix = "0x";
fprintf(fp, "#define %s%s %s%s\n",
CONFIG_, sym->name, prefix, value);
break;
}
case S_STRING:
case S_INT:
fprintf(fp, "#define %s%s %s\n",
CONFIG_, sym->name, value);
break;
default:
break;
}

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

static void
Expand Down

0 comments on commit eb4cf5a

Please sign in to comment.