1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:07:57 -07:00

cgo now renders types with unknown size as [0]byte instead of raising a

fatal error.
Fixes #126.

R=rsc
https://golang.org/cl/157101
This commit is contained in:
Eden Li 2009-11-19 22:09:01 -08:00 committed by Russ Cox
parent 6e0767bb04
commit b30f753dc3

View File

@ -315,11 +315,14 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
t.Size = dtype.Size(); t.Size = dtype.Size();
t.Align = -1; t.Align = -1;
t.C = dtype.Common().Name; t.C = dtype.Common().Name;
c.m[dtype] = t;
if t.Size < 0 { if t.Size < 0 {
fatal("dwarf.Type %s reports unknown size", dtype) // Unsized types are [0]byte
t.Size = 0;
t.Go = c.Opaque(0);
return t;
} }
c.m[dtype] = t;
switch dt := dtype.(type) { switch dt := dtype.(type) {
default: default:
fatal("unexpected type: %s", dtype) fatal("unexpected type: %s", dtype)