This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgo patch committed: Avoid duplicate function declarations in syscall
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Thu, 17 Apr 2014 16:39:24 -0700
- Subject: libgo patch committed: Avoid duplicate function declarations in syscall
- Authentication-results: sourceware.org; auth=none
This patch from Peter Collingbourne avoids duplicate function
declarations in the generated libcalls.go file when building the syscall
package. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r 5009262c3e56 libgo/go/syscall/mksyscall.awk
--- a/libgo/go/syscall/mksyscall.awk Thu Apr 17 16:26:57 2014 -0700
+++ b/libgo/go/syscall/mksyscall.awk Thu Apr 17 16:30:29 2014 -0700
@@ -96,8 +96,11 @@
cfnresult = line
printf("// Automatically generated wrapper for %s/%s\n", gofnname, cfnname)
- printf("//extern %s\n", cfnname)
- printf("func c_%s(%s) %s\n", cfnname, cfnparams, cfnresult)
+ if (!(cfnname in cfns)) {
+ cfns[cfnname] = 1
+ printf("//extern %s\n", cfnname)
+ printf("func c_%s(%s) %s\n", cfnname, cfnparams, cfnresult)
+ }
printf("func %s(%s) %s%s%s%s{\n",
gofnname, gofnparams, gofnresults == "" ? "" : "(", gofnresults,
gofnresults == "" ? "" : ")", gofnresults == "" ? "" : " ")