From b222c9e39bb2c6a9dbb091469dd6513464c6d23b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 22 Sep 2012 05:54:13 +1000 Subject: [PATCH] [release-branch.go1] cgo: fix declarations in _cgo_export.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ««« backport 6751a0e1a6a4 cgo: fix declarations in _cgo_export.c 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 7eee671754..96e5f9afbb 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -461,6 +461,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 @@ -552,7 +554,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)