plan9: remove "use" function and calls from generated code.
Update mksyscall.pl to skip generating calls to "use".
See issue https://golang.org/issue/16607
and CL https://golang.org/cl/36616
Change-Id: Id36614fce5d98a8538edf4f4a7276e650b99b839
Reviewed-on: https://go-review.googlesource.com/c/156437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/plan9/mksyscall.pl b/plan9/mksyscall.pl
index 252e89e..f01800d 100755
--- a/plan9/mksyscall.pl
+++ b/plan9/mksyscall.pl
@@ -132,7 +132,6 @@
# Prepare arguments to Syscall.
my @args = ();
- my @uses = ();
my $n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
@@ -143,14 +142,12 @@
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n *byte\n";
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
@@ -281,9 +278,6 @@
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
}
- foreach my $use (@uses) {
- $text .= "\t$use\n";
- }
$text .= $body;
if ($plan9 && $ret[2] eq "e1") {
diff --git a/plan9/zsyscall_plan9_386.go b/plan9/zsyscall_plan9_386.go
index 78d8465..38fdee9 100644
--- a/plan9/zsyscall_plan9_386.go
+++ b/plan9/zsyscall_plan9_386.go
@@ -57,7 +57,6 @@
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if int32(r0) == -1 {
err = e1
@@ -74,7 +73,6 @@
return
}
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if int32(r0) == -1 {
err = e1
@@ -91,7 +89,6 @@
return
}
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}
@@ -113,7 +110,6 @@
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if int32(r0) == -1 {
err = e1
@@ -135,8 +131,6 @@
return
}
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if int32(r0) == -1 {
err = e1
}
@@ -157,8 +151,6 @@
return
}
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if int32(r0) == -1 {
err = e1
}
@@ -180,7 +172,6 @@
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}
@@ -196,7 +187,6 @@
return
}
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}
diff --git a/plan9/zsyscall_plan9_amd64.go b/plan9/zsyscall_plan9_amd64.go
index 78d8465..38fdee9 100644
--- a/plan9/zsyscall_plan9_amd64.go
+++ b/plan9/zsyscall_plan9_amd64.go
@@ -57,7 +57,6 @@
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- use(unsafe.Pointer(_p0))
fd = int(r0)
if int32(r0) == -1 {
err = e1
@@ -74,7 +73,6 @@
return
}
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- use(unsafe.Pointer(_p0))
fd = int(r0)
if int32(r0) == -1 {
err = e1
@@ -91,7 +89,6 @@
return
}
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}
@@ -113,7 +110,6 @@
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- use(unsafe.Pointer(_p0))
n = int(r0)
if int32(r0) == -1 {
err = e1
@@ -135,8 +131,6 @@
return
}
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if int32(r0) == -1 {
err = e1
}
@@ -157,8 +151,6 @@
return
}
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
- use(unsafe.Pointer(_p0))
- use(unsafe.Pointer(_p1))
if int32(r0) == -1 {
err = e1
}
@@ -180,7 +172,6 @@
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}
@@ -196,7 +187,6 @@
return
}
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- use(unsafe.Pointer(_p0))
if int32(r0) == -1 {
err = e1
}