summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEden Li <eden.li@gmail.com>2009-11-19 22:09:01 -0800
committerEden Li <eden.li@gmail.com>2009-11-19 22:09:01 -0800
commit35fad56a1ec09f32c18c3315479ddb277bb112a9 (patch)
tree4741720d1a6f286801b679527c7cfa196b5e1b09
parent4155846fde07aa76f9bb79fb9390fdada3974590 (diff)
downloadgolang-35fad56a1ec09f32c18c3315479ddb277bb112a9.tar.gz
cgo now renders types with unknown size as [0]byte instead of raising a
fatal error. Fixes issue 126. R=rsc http://codereview.appspot.com/157101 Committer: Russ Cox <rsc@golang.org>
-rw-r--r--src/cmd/cgo/gcc.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 5f3653976..255946d9c 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -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)