Skip to content

Commit f92e01c

Browse files
ariel-anielithepudds
authored andcommitted
runtime/cgo: fix cgoCheckArg description
The description is misleading: cgoCheckArg is called by both cgoCheckPointer and cgoCheckResult. Mention cgoCheckResult in the cgoCheckArg description. Remove extra spaces between words. For #75856 Change-Id: I6780cda76b5cb7b4f9af3fbaa37a6c5099cc8d7d GitHub-Last-Rev: 531928b GitHub-Pull-Request: #75992 Reviewed-on: https://go-review.googlesource.com/c/go/+/713520 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
1 parent 5058618 commit f92e01c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/runtime/cgocall.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//
3434
// To make it possible for gcc-compiled C code to call a Go function p.GoF,
3535
// cgo writes a gcc-compiled function named GoF (not p.GoF, since gcc doesn't
36-
// know about packages). The gcc-compiled C function f calls GoF.
36+
// know about packages). The gcc-compiled C function f calls GoF.
3737
//
3838
// GoF initializes "frame", a structure containing all of its
3939
// arguments and slots for p.GoF's results. It calls
@@ -58,10 +58,10 @@
5858
// m.g0 stack, so that it can be restored later.
5959
//
6060
// runtime.cgocallbackg (below) is now running on a real goroutine
61-
// stack (not an m.g0 stack). First it calls runtime.exitsyscall, which will
61+
// stack (not an m.g0 stack). First it calls runtime.exitsyscall, which will
6262
// block until the $GOMAXPROCS limit allows running this goroutine.
6363
// Once exitsyscall has returned, it is safe to do things like call the memory
64-
// allocator or invoke the Go callback function. runtime.cgocallbackg
64+
// allocator or invoke the Go callback function. runtime.cgocallbackg
6565
// first defers a function to unwind m.g0.sched.sp, so that if p.GoF
6666
// panics, m.g0.sched.sp will be restored to its old value: the m.g0 stack
6767
// and the m.curg stack will be unwound in lock step.
@@ -393,7 +393,7 @@ func cgocallbackg1(fn, frame unsafe.Pointer, ctxt uintptr) {
393393
// Now we need to set gp.cgoCtxt = s, but we could get
394394
// a SIGPROF signal while manipulating the slice, and
395395
// the SIGPROF handler could pick up gp.cgoCtxt while
396-
// tracing up the stack. We need to ensure that the
396+
// tracing up the stack. We need to ensure that the
397397
// handler always sees a valid slice, so set the
398398
// values in an order such that it always does.
399399
p := (*slice)(unsafe.Pointer(&gp.cgoCtxt))
@@ -594,9 +594,9 @@ func cgoCheckPointer(ptr any, arg any) {
594594
const cgoCheckPointerFail = "cgo argument has Go pointer to unpinned Go pointer"
595595
const cgoResultFail = "cgo result is unpinned Go pointer or points to unpinned Go pointer"
596596

597-
// cgoCheckArg is the real work of cgoCheckPointer. The argument p
598-
// is either a pointer to the value (of type t), or the value itself,
599-
// depending on indir. The top parameter is whether we are at the top
597+
// cgoCheckArg is the real work of cgoCheckPointer and cgoCheckResult.
598+
// The argument p is either a pointer to the value (of type t), or the value
599+
// itself, depending on indir. The top parameter is whether we are at the top
600600
// level, where Go pointers are allowed. Go pointers to pinned objects are
601601
// allowed as long as they don't reference other unpinned pointers.
602602
func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) {

0 commit comments

Comments
 (0)