diff options
author | Ian Lance Taylor <iant@golang.org> | 2015-10-16 15:26:00 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-11-10 22:22:10 +0000 |
commit | 9dcc58c3d139ee0475fdaca8119812c014ec5ba1 (patch) | |
tree | b4f7dcc9a2e8819203fce7705dcaadce1ae5fc57 /src/runtime/type.go | |
parent | 9c8cd83753fd3ebbe81a72469d8c74441123140c (diff) | |
download | go-9dcc58c3d139ee0475fdaca8119812c014ec5ba1.tar.gz go-9dcc58c3d139ee0475fdaca8119812c014ec5ba1.zip |
cmd/cgo, runtime: add checks for passing pointers from Go to C
This implements part of the proposal in issue 12416 by adding dynamic
checks for passing pointers from Go to C. This code is intended to be
on at all times. It does not try to catch every case. It does not
implement checks on calling Go functions from C.
The new cgo checks may be disabled using GODEBUG=cgocheck=0.
Update #12416.
Change-Id: I48de130e7e2e83fb99a1e176b2c856be38a4d3c8
Reviewed-on: https://go-review.googlesource.com/16003
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/type.go')
-rw-r--r-- | src/runtime/type.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go index c8d7554fca..d5f3bb1ef0 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -70,6 +70,13 @@ type maptype struct { needkeyupdate bool // true if we need to update key on an overwrite } +type arraytype struct { + typ _type + elem *_type + slice *_type + len uintptr +} + type chantype struct { typ _type elem *_type @@ -92,3 +99,16 @@ type ptrtype struct { typ _type elem *_type } + +type structfield struct { + name *string + pkgpath *string + typ *_type + tag *string + offset uintptr +} + +type structtype struct { + typ _type + fields []structfield +} |