aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/syscall
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-30 21:10:32 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-30 21:10:32 +0000
commite0be8a5c203451b47fd3da59b0e0f56cc3d42f22 (patch)
tree6b2c9662a2b212b86192a8ef1a2d7ac29c33eeb6 /libgo/go/syscall
parenta0d203b112059597603c9424e51f5cbb7b104009 (diff)
downloadgcc-e0be8a5c203451b47fd3da59b0e0f56cc3d42f22.zip
gcc-e0be8a5c203451b47fd3da59b0e0f56cc3d42f22.tar.gz
gcc-e0be8a5c203451b47fd3da59b0e0f56cc3d42f22.tar.bz2
syscall: Convert errno to error after Exitsyscall.
From-SVN: r186020
Diffstat (limited to 'libgo/go/syscall')
-rw-r--r--libgo/go/syscall/mksyscall.awk13
1 files changed, 12 insertions, 1 deletions
diff --git a/libgo/go/syscall/mksyscall.awk b/libgo/go/syscall/mksyscall.awk
index 5e30e86..b817960 100644
--- a/libgo/go/syscall/mksyscall.awk
+++ b/libgo/go/syscall/mksyscall.awk
@@ -199,6 +199,7 @@ BEGIN {
}
printf("c_%s(%s)\n", cfnname, args)
+ seterr = 0
if (gofnresults != "") {
fields = split(gofnresults, goresults, ", *")
if (fields > 2) {
@@ -218,13 +219,17 @@ BEGIN {
gotype = goparam[2]
if (goname == "err") {
+ print "\tvar errno Errno"
+ print "\tsetErrno := false"
if (cfnresult ~ /^\*/) {
print "\tif _r == nil {"
} else {
print "\tif _r < 0 {"
}
- print "\t\terr = GetErrno()"
+ print "\t\terrno = GetErrno()"
+ print "\t\tsetErrno = true"
print "\t}"
+ seterr = 1
} else if (gotype == "uintptr" && cfnresult ~ /^\*/) {
printf("\t%s = (%s)(unsafe.Pointer(_r))\n", goname, gotype)
} else {
@@ -243,6 +248,12 @@ BEGIN {
print "\tExitsyscall()"
}
+ if (seterr) {
+ print "\tif setErrno {"
+ print "\t\terr = errno"
+ print "\t}"
+ }
+
if (gofnresults != "") {
print "\treturn"
}