mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] kconfig: accept negative hexadecimals
Date: Thu, 03 Nov 2011 14:16:00 +0100	[thread overview]
Message-ID: <1320326160.14409.223.camel@x61.thuisdomein> (raw)

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


             reply	other threads:[~2011-11-03 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 13:16 Paul Bolle [this message]
2011-11-03 13:36 ` Paul Bolle

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=1320326160.14409.223.camel@x61.thuisdomein \
    --to=pebolle@tiscali.nl \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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

all inboxes | Powered by JetHome®