mirror of
https://github.com/golang/go
synced 2024-11-23 06:30:06 -07:00
cmd/cgo: accept __uint8_t as the uint8_t type
This works around the NetBSD <stdint.h> which defines the type using "#define" rather than typedef. Fixes #30918 Updates #29878 Change-Id: I8998eba52139366ae46762bdad5fcae85f9b4027 Reviewed-on: https://go-review.googlesource.com/c/go/+/168337 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
d34548e0b6
commit
72954ebcfd
@ -2483,7 +2483,9 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
|
||||
// representation.
|
||||
if exactWidthIntegerType.MatchString(dt.Name) {
|
||||
sub := c.Type(dt.Type, pos)
|
||||
u := c.exactWidthIntegerTypes[strings.TrimSuffix(dt.Name, "_t")]
|
||||
goname := strings.TrimPrefix(dt.Name, "__")
|
||||
goname = strings.TrimSuffix(goname, "_t")
|
||||
u := c.exactWidthIntegerTypes[goname]
|
||||
if sub.Size != u.Size {
|
||||
fatalf("%s: unexpected size: %d vs. %d – %s", lineno(pos), sub.Size, u.Size, dtype)
|
||||
}
|
||||
@ -2630,7 +2632,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
|
||||
return t
|
||||
}
|
||||
|
||||
var exactWidthIntegerType = regexp.MustCompile(`^u?int(8|16|32|64)_t$`)
|
||||
var exactWidthIntegerType = regexp.MustCompile(`^(__)?u?int(8|16|32|64)_t$`)
|
||||
|
||||
// isStructUnionClass reports whether the type described by the Go syntax x
|
||||
// is a struct, union, or class with a tag.
|
||||
|
Loading…
Reference in New Issue
Block a user