]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: use type aliases for #define type macros
authorMatthew Dempsky <mdempsky@google.com>
Fri, 1 May 2020 06:05:51 +0000 (23:05 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 1 May 2020 18:01:28 +0000 (18:01 +0000)
commitb565d1ec1630f6ffa50024fe14ac4ea88a2e6701
treef6bc8d523567cb92e4b027a22301e6074b5d2086
parentf00b8b45a24479836d8c148cf85fd97091290b05
cmd/cgo: use type aliases for #define type macros

Cgo's initial design for handling "#define foo int*" involved
rewriting "C.foo" to "*_Ctype_int" everywhere. But now that we have
type aliases, we can declare "type _Ctype_foo = *_Ctype_int" once, and
then rewrite "C.foo" to just "_Ctype_foo".

This is important for go/types's UsesCgo mode, where go/types needs to
be able to figure out a type for each C.foo identifier using only the
information written into _cgo_gotypes.go.

Fixes #38649.

Change-Id: Ia0f8c2d82df81efb1be5bc26195ea9154c0af871
Reviewed-on: https://go-review.googlesource.com/c/go/+/230037
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/test/test.go
misc/cgo/testgodefs/testdata/issue38649.go [new file with mode: 0644]
misc/cgo/testgodefs/testdata/main.go
misc/cgo/testgodefs/testgodefs_test.go
src/cmd/cgo/gcc.go