mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: add support for a go:noinline directive
Some tests need to disable inlining of a function. It's currently done in one of a few ways (adding a function call, an empty switch, or a defer). Add support for a less fragile 'go:noinline' directive that prevents inlining. Fixes #12312 Change-Id: Ife444e13361b4a927709d81aa41e448f32eec8d4 Reviewed-on: https://go-review.googlesource.com/13911 Run-TryBot: Todd Neal <todd@tneal.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
c9b8cab16c
commit
a92543e1a1
7 changed files with 144 additions and 119 deletions
|
|
@ -1662,6 +1662,11 @@ func getlinepragma() int {
|
|||
return c
|
||||
}
|
||||
|
||||
if verb == "go:noinline" {
|
||||
noinline = true
|
||||
return c
|
||||
}
|
||||
|
||||
if verb == "go:systemstack" {
|
||||
if compiling_runtime == 0 {
|
||||
Yyerror("//go:systemstack only allowed in runtime")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue