]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: fix declarations in _cgo_export.c
authorIan Lance Taylor <iant@golang.org>
Wed, 25 Jul 2012 21:14:37 +0000 (14:14 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 25 Jul 2012 21:14:37 +0000 (14:14 -0700)
Declare crosscall2.  Declare the functions passed to it as
returning void, rather than relying on implicit return type.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6432060

src/cmd/cgo/out.go

index 993a23ae46d363244e26d95580c6b9f85125cfbd..aa084b65c9a093c3b81e291bec821645e2ec11b5 100644 (file)
@@ -474,6 +474,8 @@ func (p *Package) writeExports(fgo2, fc, fm *os.File) {
        fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n")
        fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n")
 
+       fmt.Fprintf(fgcc, "\nextern void crosscall2(void (*fn)(void *, int), void *, int);\n\n")
+
        for _, exp := range p.ExpFunc {
                fn := exp.Func
 
@@ -565,7 +567,7 @@ func (p *Package) writeExports(fgo2, fc, fm *os.File) {
                s += ")"
                fmt.Fprintf(fgcch, "\nextern %s;\n", s)
 
-               fmt.Fprintf(fgcc, "extern _cgoexp%s_%s(void *, int);\n", cPrefix, exp.ExpName)
+               fmt.Fprintf(fgcc, "extern void _cgoexp%s_%s(void *, int);\n", cPrefix, exp.ExpName)
                fmt.Fprintf(fgcc, "\n%s\n", s)
                fmt.Fprintf(fgcc, "{\n")
                fmt.Fprintf(fgcc, "\t%s __attribute__((packed)) a;\n", ctype)