| 1 |
// errorcheck -0 -+ -p=internal/runtime/sys -m |
| 2 |
|
| 3 |
// Copyright 2024 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package sys |
| 8 |
|
| 9 |
// A function that calls sys.GetCallerPC or sys.GetCallerSP |
| 10 |
// cannot be inlined, no matter how small it is. |
| 11 |
|
| 12 |
func GetCallerPC() uintptr |
| 13 |
func GetCallerSP() uintptr |
| 14 |
|
| 15 |
func pc() uintptr { |
| 16 |
return GetCallerPC() + 1 |
| 17 |
} |
| 18 |
|
| 19 |
func cpc() uintptr { // ERROR "can inline cpc" |
| 20 |
return pc() + 2 |
| 21 |
} |
| 22 |
|
| 23 |
func sp() uintptr { |
| 24 |
return GetCallerSP() + 3 |
| 25 |
} |
| 26 |
|
| 27 |
func csp() uintptr { // ERROR "can inline csp" |
| 28 |
return sp() + 4 |
| 29 |
} |