diff options
author | Russ Cox <rsc@golang.org> | 2011-01-06 15:15:31 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-01-06 15:15:31 -0500 |
commit | 02327a72d7ae27c16ab4ed702138ca6a818e6123 (patch) | |
tree | ddc356c4f5e679c58f85167c4592b28ff3ed50a7 | |
parent | c1fbe589a931168673c57662e7dd03416218df8e (diff) | |
download | go-02327a72d7ae27c16ab4ed702138ca6a818e6123.tar.gz go-02327a72d7ae27c16ab4ed702138ca6a818e6123.zip |
cgo: disallow use of C.errno
It's incorrect, and it causes cryptic linker errors.
Fixes #1360.
R=r, r2
CC=golang-dev
https://golang.org/cl/3880041
-rw-r--r-- | src/cmd/cgo/ast.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/cgo/ast.go b/src/cmd/cgo/ast.go index 7c64a5d246..8689ac3dac 100644 --- a/src/cmd/cgo/ast.go +++ b/src/cmd/cgo/ast.go @@ -141,6 +141,10 @@ func (f *File) saveRef(x interface{}, context string) { context = "expr" } goname := sel.Sel.Name + if goname == "errno" { + error(sel.Pos(), "cannot refer to errno directly; see documentation") + return + } name := f.Name[goname] if name == nil { name = &Name{ |