go.sys/unix: use "use" in syscall interface
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/144980043
diff --git a/windows/asm.s b/windows/asm.s
new file mode 100644
index 0000000..d4ca868
--- /dev/null
+++ b/windows/asm.s
@@ -0,0 +1,8 @@
+// Copyright 2014 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.
+
+#include "textflag.h"
+
+TEXT ·use(SB),NOSPLIT,$0
+ RET
diff --git a/windows/syscall.go b/windows/syscall.go
index 784a342..281cd66 100644
--- a/windows/syscall.go
+++ b/windows/syscall.go
@@ -21,7 +21,10 @@
// holds a value of type syscall.Errno.
package windows
-import "syscall"
+import (
+ "syscall"
+ "unsafe"
+)
// ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any
@@ -67,3 +70,8 @@
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}
+
+// use is a no-op, but the compiler cannot see that it is.
+// Calling use(p) ensures that p is kept live until that point.
+//go:noescape
+func use(p unsafe.Pointer)