]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: disallow use of C.errno
authorRuss Cox <rsc@golang.org>
Thu, 6 Jan 2011 20:15:31 +0000 (15:15 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 6 Jan 2011 20:15:31 +0000 (15:15 -0500)
It's incorrect, and it causes cryptic linker errors.

Fixes #1360.

R=r, r2
CC=golang-dev
https://golang.org/cl/3880041

src/cmd/cgo/ast.go

index 7c64a5d246c9a149072d99bdd94cb610f5e6efd7..8689ac3dac2510293a975dfbf5422d7701325cb3 100644 (file)
@@ -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{