shithub: mc

Download patch

ref: 22c1d29270da65c64ba4c6420baf011f952c6c12
parent: df39695ef7997e8cfb4bb3e00976c4689edb15f5
author: andrewc <andrew_chambers@trimble.com>
date: Wed Jan 13 10:22:47 EST 2016

Require '->' to have an argument

--- a/6/simp.c
+++ b/6/simp.c
@@ -1636,7 +1636,7 @@
 			u = disp(n->loc, size(args[0]));
 			v = mkexpr(n->loc, Oblit, s->ret, t, u, NULL);
 			append(s, v);
-		} else if (n->expr.nargs && n->expr.args[0]) {
+		} else {
 			t = s->ret;
 			u = rval(s, args[0], NULL);
 			/* void calls return nothing */
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -584,7 +584,6 @@
 	;
 
 retexpr : Tret expr {$$ = mkexpr($1->loc, Oret, $2, NULL);}
-	| Tret {$$ = mkexpr($1->loc, Oret, NULL);}
 	| expr
 	;
 
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1520,10 +1520,7 @@
 			*sawret = 1;
 		if (!ret)
 			fatal(n, "returns are not valid near %s", ctxstr(st, n));
-		if (nargs)
-			t = unify(st, n, ret, type(st, args[0]));
-		else
-			t = unify(st, n, mktype(Zloc, Tyvoid), ret);
+		t = unify(st, n, ret, type(st, args[0]));
 		settype(st, n, t);
 		break;
 	case Obreak: