]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: -cdefs should translate unsafe.Pointer to void *
authorShenghou Ma <minux.ma@gmail.com>
Mon, 23 Jan 2012 19:45:30 +0000 (14:45 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 23 Jan 2012 19:45:30 +0000 (14:45 -0500)
        Fixes #2454.

R=rsc, mikioh.mikioh, golang-dev, iant, iant
CC=golang-dev
https://golang.org/cl/5557068

src/cmd/cgo/godefs.go

index df3f66ed027c040785fb6be08533a938cd41bff1..68387292740b91ccf8cef5f8603ce470315b78fc 100644 (file)
@@ -268,6 +268,11 @@ func cdecl(name, typ string) string {
                typ = typ[i:]
        }
        // X T -> T X
+       // Handle the special case: 'unsafe.Pointer' is 'void *'
+       if typ == "unsafe.Pointer" {
+               typ = "void"
+               name = "*" + name
+       }
        return typ + "\t" + name
 }