]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: resolve the TODO of processPragmas
authorLeonard Wang <wangdeyu0907@gmail.com>
Wed, 7 Jul 2021 14:33:09 +0000 (22:33 +0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 28 Oct 2021 01:15:26 +0000 (01:15 +0000)
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>

src/cmd/compile/internal/noder/noder.go
src/cmd/cover/testdata/test.go
test/linkname2.go

index fc1541f74ee9cf6cf6e63bf603958cb1f80cc887..b36db67a507a87f8cd6bd0a56791b4f34399cedc 100644 (file)
@@ -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 != "" {
index b794962205d3da7f8cdf9c37c43fecdc0473e81e..703fba57a45b414bb4cf5de7341ef5dd1f468406 100644 (file)
@@ -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"
 
index 43e66a584958bbb03fd2177b01b20f87c62c6871..cb7f9be3452a04a247391c5fc6c54a1b4e68f183 100644 (file)
@@ -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