base.ErrorfAt(fn.Pos(), "Calls to //go:registerparams method %s won't work, remove the pragma from the declaration.", name)
}
a = abi1
- base.WarnfAt(fn.Pos(), "declared function %v has register params", fn)
}
return a
}
inRegistersImported := fn.Pragma()&ir.RegisterParams != 0
inRegistersSamePackage := fn.Func != nil && fn.Func.Pragma&ir.RegisterParams != 0
inRegisters = inRegistersImported || inRegistersSamePackage
- if inRegisters {
- s.f.Warnl(n.Pos(), "called function %v has register params", callee)
- }
break
}
closure = s.expr(fn)
+++ /dev/null
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
- "fmt"
- "regabipragma.dir/tmp"
-)
-
-type S string
-
-//go:noinline
-func (s S) ff(t string) string {
- return string(s) + " " + t
-}
-
-//go:noinline
-//go:registerparams
-func f(s,t string) string { // ERROR "Declared function f has register params"
- return s + " " + t
-}
-
-func check(s string) {
- if s != "Hello world!" {
- fmt.Printf("FAIL, wanted 'Hello world!' but got '%s'\n", s)
- }
-}
-
-func main() {
- check(f("Hello", "world!")) // ERROR "Called function ...f has register params"
- check(tmp.F("Hello", "world!")) // ERROR "Called function regabipragma.dir/tmp.F has register params"
- check(S("Hello").ff("world!"))
- check(tmp.S("Hello").FF("world!"))
-}
+++ /dev/null
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package tmp
-
-
-type S string
-
-//go:noinline
-func (s S) FF(t string) string {
- return string(s) + " " + t
-}
-
-//go:noinline
-//go:registerparams
-func F(s,t string) string {
- return s + " " + t
-}
+++ /dev/null
-// skip
-// runindir -gcflags=-c=1
-//go:build !windows
-// +build !windows
-
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO(register args) Temporarily disabled now that register abi info is flowing halfway through the compiler.
-// TODO(register args) May delete or adapt this test once regabi is the default
-
-package ignore
+++ /dev/null
-# regabipragma.dir/tmp
-tmp/foo.go:17:6: declared function F has register params
-# regabipragma.dir
-./main.go:21:6: declared function f has register params
-./main.go:32:9: called function f has register params
-./main.go:33:13: called function tmp.F has register params