diff options
author | Ian Lance Taylor <iant@golang.org> | 2014-06-05 10:42:03 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2014-06-05 10:42:03 -0700 |
commit | fa055adf81fea4e70d39535f1298424482790fb6 (patch) | |
tree | ba627075ebab9a0f07e80beda2438b0de9c51d59 /src/cmd/cgo | |
parent | 99f44e32937a273412a074e3825a09fa2ab1800f (diff) | |
download | go-fa055adf81fea4e70d39535f1298424482790fb6.tar.gz |
cmd/cgo: for typedef of untagged struct, use typedef name in C code
Fixes issue 8148.
LGTM=cookieo9, rsc
R=rsc, cookieo9
CC=golang-codereviews
https://codereview.appspot.com/103080043
Diffstat (limited to 'src/cmd/cgo')
-rw-r--r-- | src/cmd/cgo/gcc.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index 0160b4b90..7a802102d 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -1283,6 +1283,11 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { if isStructUnionClass(sub.Go) || *godefs || *cdefs { t.Go = sub.Go + if isStructUnionClass(sub.Go) { + // Use the typedef name for C code. + typedef[sub.Go.(*ast.Ident).Name].C = t.C + } + // If we've seen this typedef before, and it // was an anonymous struct/union/class before // too, use the old definition. |