1
0
mirror of https://github.com/golang/go synced 2024-10-03 06:21:21 -06:00

syscall: correct code for cover cmd

Fixes #10378

This is clumsy, but currently cover tool fails as:

$ go test -run=none -cover syscall
syscall_linux_amd64.go:15: can only use //go:noescape with external func implementations
FAIL	syscall [build failed]

This happens because cover tool mishandles //go: comments.
r and gri said that fixing cover is infeasible due to go/ast limitations.

So at least fix the offending code so that coverage works.
This come up in context of coverage-guided fuzzing which works best
with program-wide coverage.

Change-Id: I142e5774c9f326ed38cb202693bd4edae93879ba
Reviewed-on: https://go-review.googlesource.com/8723
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Dmitry Vyukov 2015-04-10 12:34:31 +03:00
parent 7647741246
commit 53a8ee5011

View File

@ -57,8 +57,6 @@ const _SYS_dup = SYS_DUP2
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
func Getpagesize() int { return 4096 }
//go:noescape //go:noescape
func gettimeofday(tv *Timeval) (err Errno) func gettimeofday(tv *Timeval) (err Errno)
@ -70,6 +68,8 @@ func Gettimeofday(tv *Timeval) (err error) {
return nil return nil
} }
func Getpagesize() int { return 4096 }
func Time(t *Time_t) (tt Time_t, err error) { func Time(t *Time_t) (tt Time_t, err error) {
var tv Timeval var tv Timeval
errno := gettimeofday(&tv) errno := gettimeofday(&tv)