diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-05 15:33:39 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:01 -0700 |
| commit | bce9c9d793a708c0741f99341b70c7b8dffad415 (patch) | |
| tree | 16505a4172e4f785a586b70787f50acb31e44ecb /expression.c | |
| parent | fee71ab2c463be61679b8583292a19a4aa79f850 (diff) | |
| download | sparse-dev-bce9c9d793a708c0741f99341b70c7b8dffad415.tar.gz | |
Allow underscores in integer constants for readability.
Thus 0x1234_5678 is a valid constant, as is 100_000_ul.
The parser doesn't care where they are.
Diffstat (limited to 'expression.c')
| -rw-r--r-- | expression.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/expression.c b/expression.c index a8f39d30..c628d1ea 100644 --- a/expression.c +++ b/expression.c @@ -118,10 +118,16 @@ static void get_number_value(struct expression *expr, struct token *token) base -= 2; // the fall-through will make this 8 } } - while ((digit = hexval(*str)) < base) { + for (;;) { + char c = *str++; + if (c == '_') + continue; + digit = hexval(c); + if (digit >= base) + break; value = value * base + digit; - str++; } + str--; modifiers = 0; for (;;) { char c = *str++; |
