mirror of
https://github.com/golang/go
synced 2024-11-25 05:47:57 -07:00
cgo: show preamble gcc errors
Fixes #1081 R=rsc CC=golang-dev https://golang.org/cl/2112046
This commit is contained in:
parent
dd0dec6290
commit
b610a78b6e
@ -204,6 +204,9 @@ func (p *Package) guessKinds(f *File) []*Name {
|
|||||||
|
|
||||||
for _, line := range strings.Split(stderr, "\n", -1) {
|
for _, line := range strings.Split(stderr, "\n", -1) {
|
||||||
if len(line) < 9 || line[0:9] != "cgo-test:" {
|
if len(line) < 9 || line[0:9] != "cgo-test:" {
|
||||||
|
if len(line) > 8 && line[0:8] == "<stdin>:" {
|
||||||
|
fatal("gcc produced unexpected output:\n%s\non input:\n%s", line, b.Bytes())
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
line = line[9:]
|
line = line[9:]
|
||||||
@ -439,8 +442,9 @@ func (p *Package) rewriteRef(f *File) {
|
|||||||
case "type":
|
case "type":
|
||||||
if r.Name.Kind != "type" {
|
if r.Name.Kind != "type" {
|
||||||
error(r.Pos(), "expression C.%s used as type", r.Name.Go)
|
error(r.Pos(), "expression C.%s used as type", r.Name.Go)
|
||||||
|
} else {
|
||||||
|
expr = r.Name.Type.Go
|
||||||
}
|
}
|
||||||
expr = r.Name.Type.Go
|
|
||||||
default:
|
default:
|
||||||
if r.Name.Kind == "func" {
|
if r.Name.Kind == "func" {
|
||||||
error(r.Pos(), "must call C.%s", r.Name.Go)
|
error(r.Pos(), "must call C.%s", r.Name.Go)
|
||||||
|
Loading…
Reference in New Issue
Block a user