]> Cypherpunks repositories - gostls13.git/commitdiff
Use BitSize instead of the field's type native ByteSize when calculating
authorDevon H. O'Dell <devon.odell@gmail.com>
Thu, 17 Dec 2009 20:38:29 +0000 (12:38 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 17 Dec 2009 20:38:29 +0000 (12:38 -0800)
structs containing bitfields.

Fixes #163.

R=rsc
CC=golang-dev
https://golang.org/cl/180059

src/cmd/cgo/gcc.go

index 07bfa8ab65681e16b2ff220bbbf7a3d0b132251b..aeca50eece913eefe354bdf24c55f546a002040d 100644 (file)
@@ -693,6 +693,9 @@ func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax s
        }
 
        for _, f := range dt.Field {
+               if f.BitSize > 0 && f.BitSize != f.ByteSize*8 {
+                       continue
+               }
                if f.ByteOffset > off {
                        fld = c.pad(fld, f.ByteOffset-off)
                        off = f.ByteOffset