cgo: fix handling of signed enumerations
cgo: fix handling of signed enumerations

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
http://codereview.appspot.com/4119058

Committer: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>

dsriram/golang,ssrl/go,ssrl/go,ssrl/go,gnanderson/go,apparentlymart/golang,gnanderson/go,tv42/old-go,pombredanne/go-deleteme,dsriram/golang,ssrl/go,tv42/old-go,dsriram/golang,pombredanne/go-deleteme,tv42/old-go,tv42/old-go,apparentlymart/golang,gnanderson/go,pombredanne/go-deleteme,apparentlymart/golang,pombredanne/go-deleteme,gnanderson/go,gnanderson/go,dsriram/golang,apparentlymart/golang,apparentlymart/golang,dsriram/golang,ssrl/go,gnanderson/go,apparentlymart/golang,tv42/old-go,apparentlymart/golang,ssrl/go,pombredanne/go-deleteme,gnanderson/go,pombredanne/go-deleteme,dsriram/golang,pombredanne/go-deleteme,tv42/old-go,dsriram/golang,tv42/old-go,ssrl/go