From: Arnaud Lacombe <lacombar@gmail.com>
To: linux-kbuild@vger.kernel.org, Michal Marek <mmarek@suse.cz>
Cc: Arnaud Lacombe <lacombar@gmail.com>,
Randy Dunlap <rdunlap@xenotime.net>,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
Date: Thu, 14 Jul 2011 15:31:07 -0400 [thread overview]
Message-ID: <1310671867-5107-1-git-send-email-lacombar@gmail.com> (raw)
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>
(Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
scripts/kconfig/confdata.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index be6952c..df629ec 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
--
1.7.3.4.574.g608b.dirty
next reply other threads:[~2011-07-14 19:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-14 19:31 Arnaud Lacombe [this message]
2011-07-14 23:20 ` [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Mauro Carvalho Chehab
2011-07-15 15:43 ` Randy Dunlap
2011-07-18 14:29 ` Michal Marek
2011-07-18 15:26 ` Arnaud Lacombe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310671867-5107-1-git-send-email-lacombar@gmail.com \
--to=lacombar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mmarek@suse.cz \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox