Source file test/runtime/inlinegcpc.go

     1  // errorcheck -0 -+ -p=runtime -m
     2  
     3  // Copyright 2019 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 runtime
     8  
     9  // A function that calls runtime.getcallerpc or runtime.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  }
    30  

View as plain text