diff options
author | David Symonds <dsymonds@golang.org> | 2014-06-03 11:18:01 +1000 |
---|---|---|
committer | David Symonds <dsymonds@golang.org> | 2014-06-03 11:18:01 +1000 |
commit | cff923d68723610d05cdbcf6cfcce09b52b995e9 (patch) | |
tree | 977ea09f9411b047d14f9764d0a8e46a15be0e2b /misc | |
parent | e3f3f1e47c3408205efe0ade7f07585c0d6a07d7 (diff) | |
download | go-cff923d68723610d05cdbcf6cfcce09b52b995e9.tar.gz |
[release-branch.go1.3] cmd/cgo: use same Go type for typedef to anonymous struct
??? CL 102080043 / 256d975c53cb
cmd/cgo: use same Go type for typedef to anonymous struct
If we see a typedef to an anonymous struct more than once,
presumably in two different Go files that import "C", use the
same Go type name.
Fixes issue 8133.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/102080043
???
TBR=adg
CC=golang-codereviews
https://codereview.appspot.com/102100043
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/test/issue8331.h | 7 | ||||
-rw-r--r-- | misc/cgo/test/issue8331a.go | 15 | ||||
-rw-r--r-- | misc/cgo/test/issue8331b.go | 13 |
3 files changed, 35 insertions, 0 deletions
diff --git a/misc/cgo/test/issue8331.h b/misc/cgo/test/issue8331.h new file mode 100644 index 000000000..936ae9d5c --- /dev/null +++ b/misc/cgo/test/issue8331.h @@ -0,0 +1,7 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +typedef struct { + int i; +} issue8331; diff --git a/misc/cgo/test/issue8331a.go b/misc/cgo/test/issue8331a.go new file mode 100644 index 000000000..7fa55be43 --- /dev/null +++ b/misc/cgo/test/issue8331a.go @@ -0,0 +1,15 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 8331. A typedef of an unnamed struct is the same struct when +// #include'd twice. No runtime test; just make sure it compiles. + +package cgotest + +// #include "issue8331.h" +import "C" + +func issue8331a() C.issue8331 { + return issue8331Var +} diff --git a/misc/cgo/test/issue8331b.go b/misc/cgo/test/issue8331b.go new file mode 100644 index 000000000..d52aed63e --- /dev/null +++ b/misc/cgo/test/issue8331b.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 8331. A typedef of an unnamed struct is the same struct when +// #include'd twice. No runtime test; just make sure it compiles. + +package cgotest + +// #include "issue8331.h" +import "C" + +var issue8331Var C.issue8331 |