aboutsummaryrefslogtreecommitdiff
path: root/test/runtime/inlinegcpc.go
blob: c423993b713428c888f76ae6281724dd99dd6a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// errorcheck -0 -+ -p=runtime -m

// Copyright 2019 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 runtime

// A function that calls runtime.getcallerpc or runtime.getcallersp()
// cannot be inlined, no matter how small it is.

func getcallerpc() uintptr
func getcallersp() uintptr

func pc() uintptr {
	return getcallerpc() + 1
}

func cpc() uintptr { // ERROR "can inline cpc"
	return pc() + 2
}

func sp() uintptr {
	return getcallersp() + 3
}

func csp() uintptr { // ERROR "can inline csp"
	return sp() + 4
}