mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kconfig: accept negative hexadecimals
@ 2011-11-03 13:16 Paul Bolle
  2011-11-03 13:36 ` Paul Bolle
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Bolle @ 2011-11-03 13:16 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

Kconfig will print a warning when confronted with a negative "hex"
value:
	'number is invalid'

Make this warning disappear for valid negative hexadecimals (ie, valid
hexadecimal numbers that start with a minus sign, optionally followed by
"0x").

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
I ran into this while trying some possible cleanups to various "hex"
config entries, for which I needed to add a negative default. Currently
there are no "hex" config entries with a negative default. (I don't know
whether this warning can be triggered any other way.)

This also allows to enter negative values for "hex" config entries.
Apparently that's currently not needed. But these will then show up as
(eg) "0x-ff" in the GUI. Should that be fixed in a separate commit or
should I update this patch?

 scripts/kconfig/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 071f00c..2b33478 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -551,6 +551,8 @@ bool sym_string_valid(struct symbol *sym, const char *str)
 		}
 		return true;
 	case S_HEX:
+		if (str[0] == '-')
+			str++;
 		if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
 			str += 2;
 		ch = *str++;
-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-03 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 13:16 [PATCH] kconfig: accept negative hexadecimals Paul Bolle
2011-11-03 13:36 ` Paul Bolle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®