Commit 6758eedf authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: remove Pointer from builtin/unsafe.go

We already explicitly construct the "unsafe.Pointer" type in typeinit
because we need it for Types[TUNSAFEPTR]. No point in also having it
in builtin/unsafe.go if it just means (*importer).importtype needs to
fix it.

Change-Id: Ife8a5a73cbbe2bfcabe8b25ee4f7e0f5fd0570b4
Reviewed-on: https://go-review.googlesource.com/29082
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent b11c79fd
...@@ -390,13 +390,6 @@ func (p *importer) newtyp(etype EType) *Type { ...@@ -390,13 +390,6 @@ func (p *importer) newtyp(etype EType) *Type {
// importtype declares that pt, an imported named type, has underlying type t. // importtype declares that pt, an imported named type, has underlying type t.
func (p *importer) importtype(pt, t *Type) { func (p *importer) importtype(pt, t *Type) {
// override declaration in unsafe.go for Pointer.
// there is no way in Go code to define unsafe.Pointer
// so we have to supply it.
if incannedimport != 0 && importpkg.Name == "unsafe" && pt.Nod.Sym.Name == "Pointer" {
t = Types[TUNSAFEPTR]
}
if pt.Etype == TFORW { if pt.Etype == TFORW {
n := pt.Nod n := pt.Nod
copytype(pt.Nod, t) copytype(pt.Nod, t)
......
...@@ -106,6 +106,5 @@ const runtimeimport = "" + ...@@ -106,6 +106,5 @@ const runtimeimport = "" +
"\x11msanwrite\x00\x04\x16\x96\x03\x00`\x16\x98\x03\x00`\x00\v\xf8\x01\v\x00\x01\x00\n$$\n" "\x11msanwrite\x00\x04\x16\x96\x03\x00`\x16\x98\x03\x00`\x00\v\xf8\x01\v\x00\x01\x00\n$$\n"
const unsafeimport = "" + const unsafeimport = "" +
"version 2\n\n\x00\x00\x01\vunsafe\x00\x05\r\rPointer\x00\x16\x00\t\x0fOff" + "version 2\n\n\x00\x00\x01\vunsafe\x00\t\x0fOffsetof\x00\x01:\x00\x01\x16\x00\t" +
"setof\x00\x01:\x00\x01\x16\x00\t\vSizeof\x00\x01:\x00\x01\x16\x00\t\rAlignof\x00\x01:\x00" + "\vSizeof\x00\x01:\x00\x01\x16\x00\t\rAlignof\x00\x01:\x00\x01\x16\x00\v\x06\v\x00\x01\x00\n$$\n"
"\x01\x16\x00\v\b\v\x00\x01\x00\n$$\n"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
package unsafe package unsafe
type Pointer uintptr // not really; filled in by compiler // Type Pointer is constructed directly in typeinit.
// return types here are ignored; see unsafe.go // return types here are ignored; see unsafe.go
func Offsetof(any) uintptr func Offsetof(any) uintptr
......
...@@ -163,7 +163,6 @@ func typeinit() { ...@@ -163,7 +163,6 @@ func typeinit() {
t.Sym = Pkglookup("Pointer", unsafepkg) t.Sym = Pkglookup("Pointer", unsafepkg)
t.Sym.Def = typenod(t) t.Sym.Def = typenod(t)
t.Sym.Def.Name = new(Name) t.Sym.Def.Name = new(Name)
dowidth(Types[TUNSAFEPTR]) dowidth(Types[TUNSAFEPTR])
Tptr = TPTR32 Tptr = TPTR32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment