mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: map C unsigned char back to _Ctype_uchar in error messages
Fixes #13635. Change-Id: Icab4a45567f435f002a8f6c85db9538acf054a70 Reviewed-on: https://go-review.googlesource.com/17863 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
e8e786c20d
commit
a766d8e59c
3 changed files with 34 additions and 6 deletions
24
misc/cgo/errors/issue13635.go
Normal file
24
misc/cgo/errors/issue13635.go
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// issue 13635: used to output error about C.unsignedchar.
|
||||||
|
// This test tests all such types.
|
||||||
|
|
||||||
|
package pkg
|
||||||
|
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var (
|
||||||
|
_ C.uchar = "uc" // ERROR HERE
|
||||||
|
_ C.schar = "sc" // ERROR HERE
|
||||||
|
_ C.ushort = "us" // ERROR HERE
|
||||||
|
_ C.uint = "ui" // ERROR HERE
|
||||||
|
_ C.ulong = "ul" // ERROR HERE
|
||||||
|
_ C.longlong = "ll" // ERROR HERE
|
||||||
|
_ C.ulonglong = "ull" // ERROR HERE
|
||||||
|
_ C.complexfloat = "cf" // ERROR HERE
|
||||||
|
_ C.complexdouble = "cd" // ERROR HERE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,7 @@ check() {
|
||||||
|
|
||||||
expect() {
|
expect() {
|
||||||
file=$1
|
file=$1
|
||||||
error=$2
|
shift
|
||||||
if go build $file >errs 2>&1; then
|
if go build $file >errs 2>&1; then
|
||||||
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected cgo to fail but it succeeded
|
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected cgo to fail but it succeeded
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -25,11 +25,13 @@ expect() {
|
||||||
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output but saw none
|
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output but saw none
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! fgrep $error errs >/dev/null 2>&1; then
|
for error; do
|
||||||
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output to contain \"$error\" but saw:
|
if ! fgrep $error errs >/dev/null 2>&1; then
|
||||||
cat 1>&2 errs
|
echo 1>&2 misc/cgo/errors/test.bash: BUG: expected error output to contain \"$error\" but saw:
|
||||||
exit 1
|
cat 1>&2 errs
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
check err1.go
|
check err1.go
|
||||||
|
|
@ -41,6 +43,7 @@ check issue11097a.go
|
||||||
check issue11097b.go
|
check issue11097b.go
|
||||||
expect issue13129.go C.ushort
|
expect issue13129.go C.ushort
|
||||||
check issue13423.go
|
check issue13423.go
|
||||||
|
expect issue13635.go C.uchar C.schar C.ushort C.uint C.ulong C.longlong C.ulonglong C.complexfloat C.complexdouble
|
||||||
|
|
||||||
if ! go run ptr.go; then
|
if ! go run ptr.go; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -1319,6 +1319,7 @@ var dwarfToName = map[string]string{
|
||||||
"long long int": "longlong",
|
"long long int": "longlong",
|
||||||
"long long unsigned int": "ulonglong",
|
"long long unsigned int": "ulonglong",
|
||||||
"signed char": "schar",
|
"signed char": "schar",
|
||||||
|
"unsigned char": "uchar",
|
||||||
}
|
}
|
||||||
|
|
||||||
const signedDelta = 64
|
const signedDelta = 64
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue