mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: fix C.complexfloat and C.complexdouble
This also fixes an unintended behavior where C's "complex float" and "complex double" types were interchangeable with Go's "complex64" and "complex128" types. Fixes #13402. Change-Id: I73f96d9a4772088d495073783c6982e9634430e8 Reviewed-on: https://go-review.googlesource.com/17208 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
de640d369d
commit
10cb39afc4
4 changed files with 17 additions and 8 deletions
|
|
@ -38,8 +38,8 @@ var nameToC = map[string]string{
|
|||
"ulong": "unsigned long",
|
||||
"longlong": "long long",
|
||||
"ulonglong": "unsigned long long",
|
||||
"complexfloat": "float complex",
|
||||
"complexdouble": "double complex",
|
||||
"complexfloat": "__complex float",
|
||||
"complexdouble": "__complex double",
|
||||
}
|
||||
|
||||
// cname returns the C name to use for C.s.
|
||||
|
|
@ -1319,8 +1319,6 @@ var dwarfToName = map[string]string{
|
|||
"long long int": "longlong",
|
||||
"long long unsigned int": "ulonglong",
|
||||
"signed char": "schar",
|
||||
"float complex": "complexfloat",
|
||||
"double complex": "complexdouble",
|
||||
}
|
||||
|
||||
const signedDelta = 64
|
||||
|
|
@ -1690,7 +1688,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
|
|||
}
|
||||
|
||||
switch dtype.(type) {
|
||||
case *dwarf.AddrType, *dwarf.BoolType, *dwarf.CharType, *dwarf.IntType, *dwarf.FloatType, *dwarf.UcharType, *dwarf.UintType:
|
||||
case *dwarf.AddrType, *dwarf.BoolType, *dwarf.CharType, *dwarf.ComplexType, *dwarf.IntType, *dwarf.FloatType, *dwarf.UcharType, *dwarf.UintType:
|
||||
s := dtype.Common().Name
|
||||
if s != "" {
|
||||
if ss, ok := dwarfToName[s]; ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue