summaryrefslogtreecommitdiff
path: root/scripts/kconfig
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 16:29:29 +0200
commiteb4cf5a642f6430cffff7ba5d8d9bd46ea409281 (patch)
tree6cb05ea1abb119903315143cd32c1a86340606c5 /scripts/kconfig
parenta1e806550e566e987e06561873ab8276ee54d130 (diff)
downloadlwn-eb4cf5a642f6430cffff7ba5d8d9bd46ea409281.tar.gz
lwn-eb4cf5a642f6430cffff7ba5d8d9bd46ea409281.zip
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/kconfig')
-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 =
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