]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: add missing semicolon in generated struct
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 18 Jul 2011 14:23:52 +0000 (07:23 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 18 Jul 2011 14:23:52 +0000 (07:23 -0700)
This affected certain signatures needing padding
like:

//export Foo
func Foo() (int, C.long) { ... }

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

misc/cgo/test/Makefile
misc/cgo/test/exports.go [new file with mode: 0644]
src/cmd/cgo/out.go

index 43c45f416e22821c8d98ff18279dd4e8c0f9254e..f26f972898b30c280e70cdcc42848324eafa1bb3 100644 (file)
@@ -11,6 +11,7 @@ CGOFILES=\
        basic.go\
        callback.go\
        env.go\
+       exports.go\
        issue1222.go\
        issue1328.go\
        issue1560.go\
diff --git a/misc/cgo/test/exports.go b/misc/cgo/test/exports.go
new file mode 100644 (file)
index 0000000..f96c60b
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cgotest
+
+import "C"
+
+//export ReturnIntLong
+func ReturnIntLong() (int, C.long) {
+       return 1, 2
+}
index 5999807322354e061944682f78fdbf8b65fa7f5c..1dde2d935d93195d4c1d7232a91b32b3023cb3f1 100644 (file)
@@ -412,7 +412,7 @@ func (p *Package) writeExports(fgo2, fc, fm *os.File) {
                                t := p.cgoType(atype)
                                if off%t.Align != 0 {
                                        pad := t.Align - off%t.Align
-                                       ctype += fmt.Sprintf("\t\tchar __pad%d[%d]\n", npad, pad)
+                                       ctype += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad)
                                        off += pad
                                        npad++
                                }