1
0
mirror of https://github.com/golang/go synced 2024-11-19 20:54:39 -07:00

cmd/gc: make runtime escape an error, not a fatal error

It is more useful to report all the errors instead of just the first.

LGTM=dave, khr
R=khr, dave
CC=golang-codereviews
https://golang.org/cl/143940043
This commit is contained in:
Russ Cox 2014-09-16 09:58:17 -04:00
parent c3dbf56a14
commit 337fe4134f
2 changed files with 2 additions and 2 deletions

View File

@ -585,7 +585,7 @@ cgen_dcl(Node *n)
if(!(n->class & PHEAP)) if(!(n->class & PHEAP))
return; return;
if(compiling_runtime) if(compiling_runtime)
fatal("%N escapes to heap, not allowed in runtime.", n); yyerror("%N escapes to heap, not allowed in runtime.", n);
if(n->alloc == nil) if(n->alloc == nil)
n->alloc = callnew(n->type); n->alloc = callnew(n->type);
cgen_as(n->heapaddr, n->alloc); cgen_as(n->heapaddr, n->alloc);

View File

@ -2505,7 +2505,7 @@ paramstoheap(Type **argin, int out)
// generate allocation & copying code // generate allocation & copying code
if(compiling_runtime) if(compiling_runtime)
fatal("%N escapes to heap, not allowed in runtime.", v); yyerror("%N escapes to heap, not allowed in runtime.", v);
if(v->alloc == nil) if(v->alloc == nil)
v->alloc = callnew(v->type); v->alloc = callnew(v->type);
nn = list(nn, nod(OAS, v->heapaddr, v->alloc)); nn = list(nn, nod(OAS, v->heapaddr, v->alloc));