• Gustavo Niemeyer's avatar
    cgo: fix handling of signed enumerations · 45217825
    Gustavo Niemeyer authored
    Structs defined in C as containing a field with
    an enum type are currently translated to Go as
    a struct with an unsigned integer field, even if
    some of the values contained in the enum are
    negative.
    
    This modification takes in consideration the values
    defined in the enum, and conditionally defines the
    Go type as signed if necessary.
    
    The logic introduced was tested with gcc, which
    will increase the type size if it contains both
    negative numbers and values greater than 2^b/2-1,
    and refuses to compile values which would be
    problematic (2^64-1, but in fact the ISO C
    restricts the range to the size of int).
    
    R=rsc
    CC=golang-dev
    https://golang.org/cl/4119058
    45217825
Name
Last commit
Last update
..
Makefile Loading commit data...
ast.go Loading commit data...
doc.go Loading commit data...
gcc.go Loading commit data...
main.go Loading commit data...
out.go Loading commit data...
util.go Loading commit data...