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>
}
n := ir.AsNode(typecheck.Lookup(l.local).Def)
if n == nil || n.Op() != ir.ONAME {
- // TODO(mdempsky): Change to p.errorAt before Go 1.17 release.
- // base.WarnfAt(p.makeXPos(l.pos), "//go:linkname must refer to declared function or variable (will be an error in Go 1.17)")
+ p.errorAt(l.pos, "//go:linkname must refer to declared function or variable")
continue
}
if n.Sym().Linkname != "" {
import _ "unsafe" // for go:linkname
//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"
//go:linkname x ok
// ERROR "//go:linkname requires linkname argument or -p compiler flag"
-// BAD: want 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 "//go:linkname must refer to declared function or variable"
// 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
//go:linkname y
//go:linkname nonexist nonexist