This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgo patch committed: Avoid duplicate function declarations in syscall


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 == "" ? "" : " ")

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]