diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/cgo/godefs.go | 12 | ||||
| -rwxr-xr-x | src/run.bash | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/cmd/cgo/godefs.go b/src/cmd/cgo/godefs.go index 3dfedcb282..ce5ac2736c 100644 --- a/src/cmd/cgo/godefs.go +++ b/src/cmd/cgo/godefs.go @@ -261,17 +261,17 @@ func cdecl(name, typ string) string { if strings.HasPrefix(typ, "*[0]") { typ = "*void" } - // X *byte -> *X byte - if strings.HasPrefix(typ, "*") { - name = "*" + name - typ = typ[1:] - } // X [4]byte -> X[4] byte - if strings.HasPrefix(typ, "[") { + for strings.HasPrefix(typ, "[") { i := strings.Index(typ, "]") + 1 name = name + typ[:i] typ = typ[i:] } + // X *byte -> *X byte + for strings.HasPrefix(typ, "*") { + name = "*" + name + typ = typ[1:] + } // X T -> T X // Handle the special case: 'unsafe.Pointer' is 'void *' if typ == "unsafe.Pointer" { diff --git a/src/run.bash b/src/run.bash index 0324634969..4d8d04bfb3 100755 --- a/src/run.bash +++ b/src/run.bash @@ -125,6 +125,11 @@ esac ) || exit $? [ "$CGO_ENABLED" != 1 ] || +(xcd ../misc/cgo/testcdefs +./test.bash || exit 1 +) || exit $? + +[ "$CGO_ENABLED" != 1 ] || [ "$GOHOSTOS" == windows ] || (xcd ../misc/cgo/testso ./test.bash || exit 1 |
