public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
049aff9
)
Add proper support for negative constants in external initialisers.
author
David Given
<dg@cowlark.com>
Sun, 1 Jan 2017 17:56:53 +0000
(17:56 +0000)
committer
David Given
<dg@cowlark.com>
Sun, 1 Jan 2017 17:56:53 +0000
(17:56 +0000)
lang/b/compiler/b0.c
patch
|
blob
|
history
diff --git
a/lang/b/compiler/b0.c
b/lang/b/compiler/b0.c
index
16fbee1
..
a668724
100644
(file)
--- a/
lang/b/compiler/b0.c
+++ b/
lang/b/compiler/b0.c
@@
-542,6
+542,7
@@
extdef(void)
int o, dim, i;
char *bs;
char *ms;
+ int neg;
if ((o = symbol()) == EOFC || o == SEMI)
return;
@@
-549,6
+550,7
@@
extdef(void)
goto syntax;
bs = bsym->name;
i = dim = 0;
+ neg = 0;
switch(o = symbol()) {
case SEMI:
@@
-560,9
+562,16
@@
extdef(void)
/* init */
case CON:
case STRING:
+ case MINUS:
global(bs);
if (o == STRING)
bsymb(bs);
+ else if (o == MINUS) {
+ o = symbol();
+ if (o != CON)
+ goto syntax;
+ cval = -cval;
+ }
C_df_dnam(manglename(bs, 'b'));
pushsym(o);
goto init;