]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: don't ignore qualifiers, don't cast to void*
authorIan Lance Taylor <iant@golang.org>
Thu, 10 Nov 2016 22:34:32 +0000 (14:34 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 11 Nov 2016 01:31:12 +0000 (01:31 +0000)
commitfb8c896aff9549e868df58f9d40fd06b67ae7d07
tree7909ae7f900c3611f7f0b8ae2466396fb8fd822f
parentdc4a815d100b82643656ec88fd9fa8e7c705ebba
cmd/cgo: don't ignore qualifiers, don't cast to void*

The cgo tool used to simply ignore C type qualifiers. To avoid problems
when a C function expected a qualifier that was not present, cgo emitted
a cast to void* around all pointer arguments. Unfortunately, that broke
code that contains both a function declaration and a macro, when the
macro required the argument to have the right type. To fix this problem,
don't ignore qualifiers. They are easy enough to handle for the limited
set of cases that matter for cgo, in which we don't care about array or
function types.

Fixes #17537.

Change-Id: Ie2988d21db6ee016a3e99b07f53cfb0f1243a020
Reviewed-on: https://go-review.googlesource.com/33097
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
misc/cgo/test/cgo_test.go
misc/cgo/test/issue17537.go [new file with mode: 0644]
src/cmd/cgo/gcc.go
src/cmd/cgo/out.go