mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +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)
|
||||
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 != "" {
|
||||
|
|
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
|
||||
|
||||
//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"
|
||||
|
||||
|
|
|
@ -16,13 +16,10 @@ var x, y int
|
|||
//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
|
||||
|
|
Loading…
Reference in a new issue