Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1168)

Unified Diff: src/cmd/cgo/out.go

Issue 118890044: undo CL 114990044 / 99630144d7fc (Closed)
Patch Set: diff -r a622a4ff09da https://code.google.com/p/go/ Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/cgo/gcc.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/cgo/out.go
===================================================================
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -517,12 +517,16 @@
return
}
- ctype, _ := p.structType(n)
+ ctype, offset := p.structType(n)
// Gcc wrapper unpacks the C argument struct
// and calls the actual C function.
fmt.Fprintf(fgcc, "void\n")
- fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle)
+ if offset != 0 {
+ fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle)
+ } else {
+ fmt.Fprintf(fgcc, "_cgo%s%s()\n", cPrefix, n.Mangle)
+ }
fmt.Fprintf(fgcc, "{\n")
if n.AddError {
fmt.Fprintf(fgcc, "\terrno = 0;\n")
@@ -530,7 +534,9 @@
// We're trying to write a gcc struct that matches 6c/8c/5c's layout.
// Use packed attribute to force no padding in this struct in case
// gcc has different packing requirements.
- fmt.Fprintf(fgcc, "\t%s %v *a = v;\n", ctype, p.packedAttribute())
+ if offset != 0 {
+ fmt.Fprintf(fgcc, "\t%s %v *a = v;\n", ctype, p.packedAttribute())
+ }
fmt.Fprintf(fgcc, "\t")
if t := n.FuncType.Result; t != nil {
fmt.Fprintf(fgcc, "a->r = ")
« no previous file with comments | « src/cmd/cgo/gcc.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b