• 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
..
restype.go Loading commit data...