From: Eden Li Date: Mon, 30 Nov 2009 02:14:39 +0000 (-0800) Subject: cgo: use C type void for opaque types if dwarf.Common().Type returns nothing X-Git-Tag: weekly.2009-12-07~117 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=354b100567e9e75488b13f5a6555bd95f299cd3b;p=gostls13.git cgo: use C type void for opaque types if dwarf.Common().Type returns nothing Ideally, the C name would come from the typedef or pointer that references the Size<0 type, but we can't easily generate this without performing a look-ahead to see if any referencing type will become opaque. Fixes #334. Fixes #281. R=rsc https://golang.org/cl/161056 --- diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index d2a7eeaddb..7d377db54c 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -320,6 +320,9 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type { // Unsized types are [0]byte t.Size = 0; t.Go = c.Opaque(0); + if t.C == "" { + t.C = "void" + } return t; }