mirror of
https://github.com/golang/go
synced 2024-11-19 17:34:41 -07:00
cc: broken return is an error, not a warning
R=ken2 CC=golang-dev https://golang.org/cl/4626081
This commit is contained in:
parent
997c00f991
commit
d0ac84fe40
@ -127,7 +127,7 @@ tcomo(Node *n, int f)
|
|||||||
case ORETURN:
|
case ORETURN:
|
||||||
if(l == Z) {
|
if(l == Z) {
|
||||||
if(n->type->etype != TVOID)
|
if(n->type->etype != TVOID)
|
||||||
warn(n, "null return of a typed function");
|
diag(n, "null return of a typed function");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(tcom(l))
|
if(tcom(l))
|
||||||
|
@ -112,7 +112,7 @@ codgen(Node *n, Node *nn)
|
|||||||
warnreach = 1;
|
warnreach = 1;
|
||||||
gen(n);
|
gen(n);
|
||||||
if(canreach && thisfn->link->etype != TVOID)
|
if(canreach && thisfn->link->etype != TVOID)
|
||||||
warn(Z, "no return at end of function: %s", n1->sym->name);
|
diag(Z, "no return at end of function: %s", n1->sym->name);
|
||||||
noretval(3);
|
noretval(3);
|
||||||
gbranch(ORETURN);
|
gbranch(ORETURN);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user