1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:46:47 -07:00

cmd/gc: fix a spurious -u compile error

Fixes #4082.

R=dsymonds
CC=golang-dev
https://golang.org/cl/6545055
This commit is contained in:
Russ Cox 2012-09-21 21:12:41 -04:00
parent f934bb8eba
commit c29f4e00a1
3 changed files with 6 additions and 3 deletions

View File

@ -919,6 +919,7 @@ EXTERN int32 thunk;
EXTERN int funcdepth;
EXTERN int typecheckok;
EXTERN int compiling_runtime;
EXTERN int compiling_wrappers;
/*
* y.tab.c

View File

@ -210,22 +210,26 @@ methods(Type *t)
// but we can generate more efficient code
// using genembedtramp if all that is necessary
// is a pointer adjustment and a JMP.
compiling_wrappers = 1;
if(isptr[it->etype] && isptr[this->etype]
&& f->embedded && !isifacemethod(f->type))
genembedtramp(it, f, a->isym, 1);
else
genwrapper(it, f, a->isym, 1);
compiling_wrappers = 0;
}
}
if(!(a->tsym->flags & SymSiggen)) {
a->tsym->flags |= SymSiggen;
if(!eqtype(this, t)) {
compiling_wrappers = 1;
if(isptr[t->etype] && isptr[this->etype]
&& f->embedded && !isifacemethod(f->type))
genembedtramp(t, f, a->tsym, 0);
else
genwrapper(t, f, a->tsym, 0);
compiling_wrappers = 0;
}
}
}

View File

@ -1536,9 +1536,7 @@ ret:
}
}
// TODO(rsc): should not need to check importpkg,
// but reflect mentions unsafe.Pointer.
if(safemode && !incannedimport && !importpkg && t && t->etype == TUNSAFEPTR)
if(safemode && !incannedimport && !importpkg && !compiling_wrappers && t && t->etype == TUNSAFEPTR)
yyerror("cannot use unsafe.Pointer");
evconst(n);