syscall: delete the "use" function and calls in non-generated files.

Delete use stub from asm.s, leaving only a dummy file.
Deleting the file causes Windows build to fail.

Fixes #16607

Change-Id: Ic5a55e042e588f1e1bc6605a3d309d1eabdeb288
Reviewed-on: https://go-review.googlesource.com/36716
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Sameer Ajmani 2017-02-10 09:22:35 -05:00
parent e9bb9e597e
commit 5a303aa1e9
12 changed files with 3 additions and 28 deletions

View file

@ -2,7 +2,6 @@
// 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
// Dummy asm file to keep Windows building.
// TODO(sameer): delete this after updating go tool
// per Ian's comment in golang.org/cl/36716

View file

@ -87,7 +87,6 @@ func (d *DLL) FindProc(name string) (proc *Proc, err error) {
return nil, err
}
a, e := getprocaddress(uintptr(d.Handle), namep)
use(unsafe.Pointer(namep))
if e != 0 {
return nil, &DLLError{
Err: e,

View file

@ -26,8 +26,6 @@
//
package syscall
import "unsafe"
//go:generate go run mksyscall_windows.go -systemdll -output zsyscall_windows.go syscall_windows.go security_windows.go
// StringByteSlice converts a string to a NUL-terminated []byte,
@ -98,11 +96,3 @@ func (tv *Timeval) Nano() int64 {
// Getpagesize is provided by the runtime.
func Getpagesize() int
// 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.
// This was needed until Go 1.6 to call syscall.Syscall correctly.
// As of Go 1.6 the compiler handles that case automatically.
// The uses and definition of use can be removed early in the Go 1.7 cycle.
//go:noescape
func use(p unsafe.Pointer)

View file

@ -127,7 +127,6 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
uintptr(options),
0,
)
use(unsafe.Pointer(_p0))
if e1 != 0 {
return nil, e1
}
@ -180,7 +179,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1

View file

@ -100,7 +100,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1

View file

@ -113,7 +113,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = e1

View file

@ -127,7 +127,6 @@ func Futimesat(dirfd int, path string, tv []Timeval) (err error) {
return err
}
err = futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
use(unsafe.Pointer(pathp))
return err
}
@ -790,7 +789,6 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
return err
}
err = mount(source, target, fstype, flags, datap)
use(unsafe.Pointer(datap))
return err
}

View file

@ -354,7 +354,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return err
}
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(pathp))
if e != 0 {
err = e
}

View file

@ -123,7 +123,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return err
}
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(pathp))
if e != 0 {
err = e
}

View file

@ -72,7 +72,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
func Fstatfs(fd int, buf *Statfs_t) (err error) {
_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(buf))
if e != 0 {
err = errnoErr(e)
}
@ -85,7 +84,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return err
}
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(p))
if e != 0 {
err = errnoErr(e)
}

View file

@ -96,7 +96,6 @@ func Pipe2(p []int, flags int) (err error) {
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
use(unsafe.Pointer(&mmap_args[0]))
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)

View file

@ -251,9 +251,7 @@ func Unmount(name, old string) (err error) {
return err
}
r0, _, e = Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(namep)), oldptr, 0)
use(unsafe.Pointer(namep))
}
use(unsafe.Pointer(oldp))
if int32(r0) == -1 {
err = e