mirror of
https://github.com/golang/go
synced 2024-11-13 19:50:21 -07:00
94076feef5
We need to determine whether arguments to and return values from C functions are "bad" typedef'd pointer types which need to be uintptr on the Go side. The type of those arguments are not specified explicitly. As a result, we never look through the C declarations for the GetTypeID functions associated with that type, and never realize that they are bad. However, in another function in the same package there might be an explicit reference. Then we end up with the declaration being uintptr in one file and *struct{...} in another file. Badness ensues. Fix this by doing a 2-pass algorithm. In the first pass, we run as normal, but record all the argument and result types we see. In the second pass, we include those argument types also when reading the C types. Fixes #24161 Change-Id: I8d727e73a2fbc88cb9d9899f8719ae405f59f753 Reviewed-on: https://go-review.googlesource.com/122575 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
20 lines
397 B
Go
20 lines
397 B
Go
// Copyright 2018 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.
|
|
|
|
// +build darwin
|
|
|
|
package issue24161arg
|
|
|
|
/*
|
|
#cgo LDFLAGS: -framework CoreFoundation
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
*/
|
|
import "C"
|
|
import "testing"
|
|
|
|
func Test(t *testing.T) {
|
|
a := test24161array()
|
|
C.CFArrayCreateCopy(0, a)
|
|
}
|