]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: fix handling of defs_linux.go
authorMatthew Dempsky <mdempsky@google.com>
Wed, 6 Aug 2014 01:12:32 +0000 (18:12 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Aug 2014 01:12:32 +0000 (18:12 -0700)
commitf7a8adbd511e921111fc0682d380a6f7a33e0c93
treead4c08167f3e0c6b142f9b1540bc794d7d415f09
parent48e75337839d21079c9763d3447ade409ee2c32a
cmd/cgo: fix handling of defs_linux.go

Instead of including <sys/types.h> to get size_t, instead include
the ISO C standard <stddef.h> header, which defines fewer additional
types at risk of colliding with the user code.  In particular, this
prevents collisions between <sys/types.h>'s userspace definitions with
the kernel definitions needed by defs_linux.go.

Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields.

Fixes #8477.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/120610043
misc/cgo/testcdefs/cdefstest.c
misc/cgo/testcdefs/cdefstest.go
misc/cgo/testcdefs/main.c
src/cmd/cgo/gcc.go
src/cmd/cgo/out.go
src/pkg/runtime/defs_linux.go