From: David Crawshaw Date: Sun, 18 Oct 2015 17:32:11 +0000 (-0400) Subject: cmd/cgo: give __uint128_t type [16]uint8 X-Git-Tag: go1.6beta1~799 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fd8592859b3b4214276ff6ff846db7ead21215c6;p=gostls13.git cmd/cgo: give __uint128_t type [16]uint8 The __uint128_t type appears in darwin/arm header files processed by cgo -godefs in http://golang.org/cl/16045. Change-Id: I666194c65dee8ea0ae933d2f02a3abe4581c4697 Reviewed-on: https://go-review.googlesource.com/16046 Reviewed-by: Ian Lance Taylor Run-TryBot: David Crawshaw TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index f82d782055..723bbfe6ad 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -119,6 +119,7 @@ C.short, C.ushort (unsigned short), C.int, C.uint (unsigned int), C.long, C.ulong (unsigned long), C.longlong (long long), C.ulonglong (unsigned long long), C.float, C.double. The C type void* is represented by Go's unsafe.Pointer. +The C types __int128_t and __uint128_t are represented by [16]byte. To access a struct, union, or enum type directly, prefix it with struct_, union_, or enum_, as in C.struct_stat. diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index b65b6cb7a9..198c05452f 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -1227,6 +1227,11 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { t.Go = c.int32 case 8: t.Go = c.int64 + case 16: + t.Go = &ast.ArrayType{ + Len: c.intExpr(t.Size), + Elt: c.uint8, + } } if t.Align = t.Size; t.Align >= c.ptrSize { t.Align = c.ptrSize @@ -1384,6 +1389,11 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { t.Go = c.uint32 case 8: t.Go = c.uint64 + case 16: + t.Go = &ast.ArrayType{ + Len: c.intExpr(t.Size), + Elt: c.uint8, + } } if t.Align = t.Size; t.Align >= c.ptrSize { t.Align = c.ptrSize