• 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
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...