mirror of
https://github.com/golang/go.git
synced 2024-09-22 02:48:50 +00:00
cmd/compile: resolve the TODO of processPragmas
Change-Id: Id723ecc2480aea2d8acb4d3e05db4a6c8eef9cc8 Reviewed-on: https://go-review.googlesource.com/c/go/+/333109 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Trust: Matthew Dempsky <mdempsky@google.com> Trust: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
12dc48fd54
commit
b2fe2ebab6
@ -323,8 +323,7 @@ func (p *noder) processPragmas() {
|
|||||||
}
|
}
|
||||||
n := ir.AsNode(typecheck.Lookup(l.local).Def)
|
n := ir.AsNode(typecheck.Lookup(l.local).Def)
|
||||||
if n == nil || n.Op() != ir.ONAME {
|
if n == nil || n.Op() != ir.ONAME {
|
||||||
// TODO(mdempsky): Change to p.errorAt before Go 1.17 release.
|
p.errorAt(l.pos, "//go:linkname must refer to declared function or variable")
|
||||||
// base.WarnfAt(p.makeXPos(l.pos), "//go:linkname must refer to declared function or variable (will be an error in Go 1.17)")
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if n.Sym().Linkname != "" {
|
if n.Sym().Linkname != "" {
|
||||||
|
1
src/cmd/cover/testdata/test.go
vendored
1
src/cmd/cover/testdata/test.go
vendored
@ -13,6 +13,7 @@ package main
|
|||||||
import _ "unsafe" // for go:linkname
|
import _ "unsafe" // for go:linkname
|
||||||
|
|
||||||
//go:linkname some_name some_name
|
//go:linkname some_name some_name
|
||||||
|
var some_name int
|
||||||
|
|
||||||
const anything = 1e9 // Just some unlikely value that means "we got here, don't care how often"
|
const anything = 1e9 // Just some unlikely value that means "we got here, don't care how often"
|
||||||
|
|
||||||
|
@ -16,13 +16,10 @@ var x, y int
|
|||||||
//go:linkname x ok
|
//go:linkname x ok
|
||||||
|
|
||||||
// ERROR "//go:linkname requires linkname argument or -p compiler flag"
|
// ERROR "//go:linkname requires linkname argument or -p compiler flag"
|
||||||
// BAD: want error "//go:linkname must refer to declared function or variable"
|
// ERROR "//go:linkname must refer to declared function or variable"
|
||||||
// BAD: want error "//go:linkname must refer to declared function or variable"
|
// ERROR "//go:linkname must refer to declared function or variable"
|
||||||
// ERROR "duplicate //go:linkname for x"
|
// ERROR "duplicate //go:linkname for x"
|
||||||
|
|
||||||
// The two BAD lines are just waiting for #42938 before we can
|
|
||||||
// re-enable the errors.
|
|
||||||
|
|
||||||
//line linkname2.go:18
|
//line linkname2.go:18
|
||||||
//go:linkname y
|
//go:linkname y
|
||||||
//go:linkname nonexist nonexist
|
//go:linkname nonexist nonexist
|
||||||
|
Loading…
Reference in New Issue
Block a user