[lkml]   [2011]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] kconfig: accept negative hexadecimals
Kconfig will print a warning when confronted with a negative "hex"
'number is invalid'

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

Signed-off-by: Paul Bolle <>
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++;

 \ /
  Last update: 2011-11-03 14:19    [W:0.028 / U:151.000 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site