summaryrefslogtreecommitdiff
path: root/6/simp.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-14 23:27:06 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-14 23:27:06 -0800
commitf5a1454387098fa3abb7bf95f4123e1fac85cb7d (patch)
treec5410430516ebf119d8139c8b599732cbd545d51 /6/simp.c
parent607b2662bc1093833bfea0c49236f098271cf348 (diff)
downloadmc-f5a1454387098fa3abb7bf95f4123e1fac85cb7d.tar.gz
Initial support for void as an expression.
Diffstat (limited to '6/simp.c')
-rw-r--r--6/simp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/6/simp.c b/6/simp.c
index 03ad0b1..1f2aee3 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1328,6 +1328,8 @@ static Node *simpcall(Simp *s, Node *n, Node *dst)
for (i = 1; i < n->expr.nargs; i++) {
if (i < ft->nsub && tybase(ft->sub[i])->type == Tyvalist)
lappend(&args, &nargs, vatypeinfo(s, n));
+ if (tybase(exprtype(n->expr.args[i]))->type == Tyvoid)
+ continue;
lappend(&args, &nargs, rval(s, n->expr.args[i], NULL));
if (exprop(n->expr.args[i]) == Oaddr)
if (exprop(n->expr.args[i]->expr.args[0]) == Ovar)
@@ -1483,7 +1485,10 @@ static Node *rval(Simp *s, Node *n, Node *dst)
break;
case Olit:
switch (args[0]->lit.littype) {
- case Lchr: case Lbool: case Llbl:
+ case Lvoid:
+ case Lchr:
+ case Lbool:
+ case Llbl:
r = n;
break;
case Lint:
@@ -1535,7 +1540,8 @@ static Node *rval(Simp *s, Node *n, Node *dst)
append(s, mkexpr(n->loc, Oret, NULL));
break;
case Oasn:
- r = assign(s, args[0], args[1]);
+ if (tybase(exprtype(n))->type != Tyvoid)
+ r = assign(s, args[0], args[1]);
break;
case Ocall:
r = simpcall(s, n, dst);