1
0
mirror of https://github.com/golang/go synced 2024-11-11 21:40:21 -07:00
go/misc/cgo
Matthew Dempsky a295d59d10 cmd/cgo: prevent redeclaration of _Ctype_void when C.void is used
CL 230037 changed cmd/cgo to emit "type _Ctype_foo = bar" aliases for
all C.foo types mentioned in the original Go source files. However,
cmd/cgo already emits an appropriate type definition for _Ctype_void.
So if a source file explicitly mentions C.void, this resulted in
_Ctype_void being declared multiple times.

This CL fixes the issue by suppressing the "type _Ctype_void =
_Ctype_void" alias before printing it. This should be safe because
_Ctype_void is the only type that's specially emitted in out.go at the
moment.

A somewhat better fix might be to fix how _Ctype_void is declared in
the cmd/cgo "frontend", but this is a less invasive fix.

Fixes #39877.

Change-Id: Ief264b3847c8ef8df1478a6333647ff2cf09b63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240180
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-26 19:00:25 +00:00
..
errors cmd/cgo: do not rewrite call if there are more args than parameters 2019-07-12 17:31:29 +00:00
fortran misc/cgo/fortran: avoid writing to $PWD 2019-11-20 22:37:23 +00:00
gmp all: make copyright headers consistent with one space after period 2016-05-02 13:43:18 +00:00
life misc: remove use of relative directories in overlayDir functions 2019-11-25 16:26:15 +00:00
nocgo cmd/ld: really import runtime/cgo for external link 2014-05-20 21:36:50 -07:00
stdio misc: remove use of relative directories in overlayDir functions 2019-11-25 16:26:15 +00:00
test cmd/cgo: prevent redeclaration of _Ctype_void when C.void is used 2020-06-26 19:00:25 +00:00
testasan misc: log 'ok' from 'go run' tests on success 2019-11-25 16:43:27 +00:00
testcarchive all: remove scattered remnants of darwin/arm 2020-04-08 18:35:49 +00:00
testcshared all: remove scattered remnants of darwin/arm 2020-04-08 18:35:49 +00:00
testgodefs cmd/cgo: in -godefs mode, don't change constant to type 2020-06-11 21:53:45 +00:00
testplugin misc/cgo/testplugin: fix typo in comment 2020-06-01 23:25:14 +00:00
testsanitizers runtime: save/restore callee saved registers in arm64's sigtramp 2019-06-03 19:02:11 +00:00
testshared cmd/link: skip zero values in fingerprint check 2020-06-23 18:38:32 +00:00
testsigfwd misc: log 'ok' from 'go run' tests on success 2019-11-25 16:43:27 +00:00
testso all: remove scattered remnants of darwin/arm 2020-04-08 18:35:49 +00:00
testsovar all: remove scattered remnants of darwin/arm 2020-04-08 18:35:49 +00:00
testtls all: make copyright headers consistent with one space after period 2016-05-02 13:43:18 +00:00