public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a01523a
)
Add support for negative constants in external initialisers.
author
David Given
<dg@cowlark.com>
Sat, 31 Dec 2016 19:43:03 +0000
(19:43 +0000)
committer
David Given
<dg@cowlark.com>
Sat, 31 Dec 2016 19:43:03 +0000
(19:43 +0000)
lang/b/compiler/b0.c
patch
|
blob
|
history
diff --git
a/lang/b/compiler/b0.c
b/lang/b/compiler/b0.c
index
03123ec
..
e6845be
100644
(file)
--- a/
lang/b/compiler/b0.c
+++ b/
lang/b/compiler/b0.c
@@
-373,7
+373,15
@@
loop:
return subseq(c,PLUS,INCBEF);
case MINUS:
- return subseq(c,MINUS,DECBEF);
+ /* avoid peeking a name, which could overwrite
+ * an already set bsym. */
+ if (ctab[peekc = spnextchar()] == DIGIT) {
+ getnum();
+ cval = -cval;
+ return CON;
+ } else {
+ return subseq(c,MINUS,DECBEF);
+ }
case LESS:
if (subseq(c,0,1))