]> Cypherpunks repositories - gostls13.git/commitdiff
cgo now renders types with unknown size as [0]byte instead of raising a
authorEden Li <eden.li@gmail.com>
Fri, 20 Nov 2009 06:09:01 +0000 (22:09 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 20 Nov 2009 06:09:01 +0000 (22:09 -0800)
fatal error.
Fixes #126.

R=rsc
https://golang.org/cl/157101

src/cmd/cgo/gcc.go

index 5f3653976df4f3fa964a14265acabd858b998324..255946d9c52a1659553d03727b9edd62d78d7a81 100644 (file)
@@ -315,11 +315,14 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
        t.Size = dtype.Size();
        t.Align = -1;
        t.C = dtype.Common().Name;
+       c.m[dtype] = t;
        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) {
        default:
                fatal("unexpected type: %s", dtype)