cmd/cgo: prepare for 64-bit ints

This CL makes the size of an int controlled by a variable
in cgo instead of hard-coding 4 (or 32 bits) in various places.

Update #2188.

R=iant, r, dave
CC=golang-dev
https://golang.org/cl/6548061
This commit is contained in:
Russ Cox 2012-09-24 14:58:57 -04:00
parent 0a006b4923
commit 5501a097a9
3 changed files with 38 additions and 11 deletions

View file

@ -601,7 +601,7 @@ func (p *Package) loadDWARF(f *File, names []*Name) {
// Record types and typedef information.
var conv typeConv
conv.Init(p.PtrSize)
conv.Init(p.PtrSize, p.IntSize)
for i, n := range names {
if types[i] == nil {
continue
@ -928,14 +928,16 @@ type typeConv struct {
string ast.Expr
ptrSize int64
intSize int64
}
var tagGen int
var typedef = make(map[string]*Type)
var goIdent = make(map[string]*ast.Ident)
func (c *typeConv) Init(ptrSize int64) {
func (c *typeConv) Init(ptrSize, intSize int64) {
c.ptrSize = ptrSize
c.intSize = intSize
c.m = make(map[dwarf.Type]*Type)
c.bool = c.Ident("bool")
c.byte = c.Ident("byte")