• Keith Randall's avatar
    cmd/cgo: check function argument/return types for bad C pointer types · 94076fee
    Keith Randall authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    94076fee
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
buildid Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
test2json Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...