1
0
mirror of https://github.com/golang/go synced 2024-11-23 18:50:05 -07:00

cmd/cgo: support niladic macros for gccgo

https://golang.org/cl/43970 changed writeOutputFunc to support niladic
function-like macros; apply the corresponding change to
writeGccgoOutputFunc.

Updates #10715
Updates #18720

Change-Id: I5decb1d37ec71507466ade2eeda4b89c8785eaef
Reviewed-on: https://go-review.googlesource.com/86475
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Ian Lance Taylor 2018-01-05 16:52:53 -08:00
parent f7d8098a7b
commit 1b89dada1a

View File

@ -695,6 +695,9 @@ func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) {
fmt.Fprintf(fgcc, "(void*)")
}
}
if n.Kind == "macro" {
fmt.Fprintf(fgcc, "%s;\n", n.C)
} else {
fmt.Fprintf(fgcc, "%s(", n.C)
for i := range n.FuncType.Params {
if i > 0 {
@ -703,6 +706,7 @@ func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) {
fmt.Fprintf(fgcc, "p%d", i)
}
fmt.Fprintf(fgcc, ");\n")
}
fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
if t := n.FuncType.Result; t != nil {
fmt.Fprintf(fgcc, "\treturn ")