summaryrefslogtreecommitdiff
path: root/test/bench
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2012-06-08 02:56:23 +0800
committerShenghou Ma <minux.ma@gmail.com>2012-06-08 02:56:23 +0800
commit79d0cc4019a7aba6b4ed006e1f5a594ae6c89e78 (patch)
tree4d507d3dd7a753c187e12cebb7a8941cb69975ac /test/bench
parentebce9ee66ece1a78a1502a11a11bb099278e2531 (diff)
downloadgo-79d0cc4019a7aba6b4ed006e1f5a594ae6c89e78.tar.gz
test/bench/shoutout: fix compliation
-lm must come after the source file, versions of gcc insist this strict order. On standard compliant systems, we no longer need malloc.h for malloc. Use pkg-config(1) to get correct glib cflags and libs. Fix compiler warning in threadring.c and k-nucleotide.c. R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/6198076
Diffstat (limited to 'test/bench')
-rw-r--r--test/bench/shootout/binary-tree.c1
-rw-r--r--test/bench/shootout/k-nucleotide.c2
-rw-r--r--test/bench/shootout/threadring.c5
-rwxr-xr-xtest/bench/shootout/timing.sh4
4 files changed, 6 insertions, 6 deletions
diff --git a/test/bench/shootout/binary-tree.c b/test/bench/shootout/binary-tree.c
index 1b4070406..9c35ac52a 100644
--- a/test/bench/shootout/binary-tree.c
+++ b/test/bench/shootout/binary-tree.c
@@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
icc -O3 -ip -unroll -static binary-trees.c -lm
*/
-#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/bench/shootout/k-nucleotide.c b/test/bench/shootout/k-nucleotide.c
index 3bace391c..9c3062020 100644
--- a/test/bench/shootout/k-nucleotide.c
+++ b/test/bench/shootout/k-nucleotide.c
@@ -221,7 +221,7 @@ main ()
free(s);
- g_ptr_array_foreach(roots, free, NULL);
+ g_ptr_array_foreach(roots, (GFunc)free, NULL);
g_ptr_array_free(roots, TRUE);
return 0;
diff --git a/test/bench/shootout/threadring.c b/test/bench/shootout/threadring.c
index 2c4fb7751..a518134ba 100644
--- a/test/bench/shootout/threadring.c
+++ b/test/bench/shootout/threadring.c
@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
* contributed by Premysl Hruby
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
@@ -57,7 +58,7 @@ static struct stack stacks[THREADS];
static void* thread(void *num)
{
- int l = (int)num;
+ int l = (int)(uintptr_t)num;
int r = (l+1) % THREADS;
int token;
@@ -94,7 +95,7 @@ int main(int argc, char **argv)
pthread_mutex_lock(mutex + i);
pthread_attr_setstack(&stack_attr, &stacks[i], sizeof(struct stack));
- pthread_create(&cthread, &stack_attr, thread, (void*)i);
+ pthread_create(&cthread, &stack_attr, thread, (void*)(uintptr_t)i);
}
pthread_mutex_unlock(mutex + 0);
diff --git a/test/bench/shootout/timing.sh b/test/bench/shootout/timing.sh
index e1c5cf292..8758549bd 100755
--- a/test/bench/shootout/timing.sh
+++ b/test/bench/shootout/timing.sh
@@ -97,7 +97,7 @@ revcomp() {
nbody() {
runonly echo 'nbody -n 50000000'
- run 'gcc -O2 -lm nbody.c' a.out 50000000
+ run 'gcc -O2 nbody.c -lm' a.out 50000000
run 'gccgo -O2 nbody.go' a.out -n 50000000
run 'gc nbody' $O.out -n 50000000
run 'gc_B nbody' $O.out -n 50000000
@@ -147,7 +147,7 @@ knucleotide() {
runonly gcc -O2 fasta.c
runonly a.out 1000000 > x # should be using 25000000
runonly echo 'k-nucleotide 1000000'
- run 'gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0' a.out <x
+ run "gcc -O2 k-nucleotide.c $(pkg-config glib-2.0 --cflags --libs)" a.out <x
run 'gccgo -O2 k-nucleotide.go' a.out <x
run 'gccgo -O2 k-nucleotide-parallel.go' a.out <x
run 'gc k-nucleotide' $O.out <x