mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: don't give inconsistent typedef error for cgo-defined types
The cgo tool predefines some C types such as C.uint. Don't give an error if the type that cgo defines does not match the type in a header file. Fixes #26743 Change-Id: I9ed3b4c482b558d8ffa8bf61eb3209415b7a9e3c Reviewed-on: https://go-review.googlesource.com/127356 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
a2ef8b9c6c
commit
c29370c98e
4 changed files with 34 additions and 0 deletions
|
|
@ -403,6 +403,10 @@ func (p *Package) Record(f *File) {
|
|||
p.Name[k] = v
|
||||
} else if p.incompleteTypedef(v.Type) {
|
||||
// Nothing to do.
|
||||
} else if _, ok := nameToC[k]; ok {
|
||||
// Names we predefine may appear inconsistent
|
||||
// if some files typedef them and some don't.
|
||||
// Issue 26743.
|
||||
} else if !reflect.DeepEqual(p.Name[k], v) {
|
||||
error_(token.NoPos, "inconsistent definitions for C.%s", fixGo(k))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue