summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-09-08 23:15:02 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-09-08 23:15:02 +0400
commit4e7b0ad08cb61c29eb8fe3c423e8751014f4f601 (patch)
treecb91f534047a9c9bdf90ed46b3fcf1aed77b40da
parent12da748e4b0122240490c775bb8b4c00d8854802 (diff)
parent29e0ba480c5fb58144ff82adefb4755dc5de2b30 (diff)
downloadlibatomic_ops-4e7b0ad08cb61c29eb8fe3c423e8751014f4f601.tar.gz
Apply hotfix-7_2a6-1 to the current release.
-rw-r--r--.cvsignore3
-rw-r--r--.gitignore37
-rw-r--r--ChangeLog40
-rw-r--r--README2
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/.cvsignore1
-rw-r--r--src/.cvsignore6
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile.in1
-rw-r--r--src/atomic_ops/.cvsignore1
-rw-r--r--src/atomic_ops/sysdeps/.cvsignore1
-rw-r--r--src/atomic_ops/sysdeps/gcc/x86.h9
-rw-r--r--src/atomic_ops/sysdeps/gcc/x86_64.h9
-rw-r--r--tests/.cvsignore7
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/Makefile.in2
-rw-r--r--tests/list_atomic.c360
-rw-r--r--tests/list_atomic.template45
-rw-r--r--tests/run_parallel.inc67
-rw-r--r--tests/test_atomic.c70
-rw-r--r--tests/test_stack.c13
22 files changed, 371 insertions, 328 deletions
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index 16b8c45..0000000
--- a/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-config.log
-config.status
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d5fdf7e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+# Ignored files in libatomic_ops Git repo.
+
+Makefile
+
+/pkgconfig/atomic_ops.pc
+/pkgconfig/atomic_ops-uninstalled.pc
+/autom4te.cache/
+/config.log
+/config.status
+/libatomic_ops-*
+
+/src/*.a
+/src/*.exe
+/src/*.la
+/src/*.lib
+/src/*.lo
+/src/*.o
+/src/*.obj
+/src/.deps/
+/src/.libs/
+/src/config.h
+/src/config.h.in~
+/src/stamp-h1
+
+/tests/*.exe
+/tests/*.o
+/tests/*.obj
+/tests/.deps/
+/tests/list_atomic.i
+/tests/test_atomic
+/tests/test_atomic_pthreads
+/tests/test_malloc
+/tests/test_stack
+
+/libtool
+/ltmain.sh
+/m4/*.m4
diff --git a/ChangeLog b/ChangeLog
index af19073..57e6dc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2011-08-10 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal)
+
+ * src/Makefile.am, tests/Makefile.am: Set compiler include paths
+ to $(top_builddir)/src and $(top_srcdir)/src.
+ * src/Makefile.in: Regenerate.
+ * tests/Makefile.in: Ditto.
+
+2011-07-14 Ivan Maidanski <ivmai@mail.ru>
+
+ * tests/list_atomic.template (list_atomicXX): Remove "addr" local
+ variable (use "&val" instead); initialize "newval" and "oldval"
+ local variables; rename "tsaddr" local variable to "ts" one.
+ * tests/list_atomic.template (list_atomicXX): Fix
+ AO_test_and_setXX call (pass address instead of value).
+ * tests/list_atomic.template: Expand all tabs to spaces; remove
+ trailing spaces at EOLn.
+ * tests/run_parallel.inc: Ditto.
+ * tests/test_atomic.c: Ditto.
+ * tests/list_atomic.c: Regenerate.
+ * tests/run_parallel.inc (AO_PTRDIFF_T): New macro.
+ * tests/run_parallel.inc (tramp): Cast between pointer and integer
+ types via casting to AO_PTRDIFF_T.
+ * tests/test_atomic.c (add1sub1_thr, acqrel_thr): Ditto.
+ * tests/run_parallel.inc (run_parallel): Adjust printf format
+ specifiers for DWORD parameters.
+ * tests/test_stack.c: Skip test if no pthreads.
+
+2011-06-27 Ivan Maidanski <ivmai@mail.ru> (really Jeremy Huddleston)
+
+ * src/atomic_ops/sysdeps/gcc/x86.h (AO_test_and_set_full):
+ Explicitly cast 0xff to unsigned char (otherwise LLVM v2.7 GAS
+ reports an error); don't recognize AO_XCHGB_RET_WORD.
+ * src/atomic_ops/sysdeps/gcc/x86_64.h (AO_test_and_set_full):
+ Ditto.
+
+2011-06-15 Ivan Maidanski <ivmai@mail.ru>
+
+ * configure.ac, README: Change to version 7.2alpha7.
+ * configure: Regenerate.
+
[7.2alpha6]
2011-06-14 Ivan Maidanski <ivmai@mail.ru>
diff --git a/README b/README
index 57b99b7..94ebb69 100644
--- a/README
+++ b/README
@@ -15,7 +15,7 @@ atomic memory operations. These might allow you to write code:
For details and licensing restrictions see the files in the doc
subdirectory.
-This is version 7.2alpha6 of libatomic_ops.
+This is version 7.2alpha7 of libatomic_ops.
You might find a more recent version of this at
diff --git a/configure b/configure
index 7748fdc..75bbeb5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for libatomic_ops 7.2alpha6.
+# Generated by GNU Autoconf 2.68 for libatomic_ops 7.2alpha7.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -557,8 +557,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libatomic_ops'
PACKAGE_TARNAME='libatomic_ops'
-PACKAGE_VERSION='7.2alpha6'
-PACKAGE_STRING='libatomic_ops 7.2alpha6'
+PACKAGE_VERSION='7.2alpha7'
+PACKAGE_STRING='libatomic_ops 7.2alpha7'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1264,7 +1264,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libatomic_ops 7.2alpha6 to adapt to many kinds of systems.
+\`configure' configures libatomic_ops 7.2alpha7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1335,7 +1335,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libatomic_ops 7.2alpha6:";;
+ short | recursive ) echo "Configuration of libatomic_ops 7.2alpha7:";;
esac
cat <<\_ACEOF
@@ -1424,7 +1424,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libatomic_ops configure 7.2alpha6
+libatomic_ops configure 7.2alpha7
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1702,7 +1702,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libatomic_ops $as_me 7.2alpha6, which was
+It was created by libatomic_ops $as_me 7.2alpha7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2631,7 +2631,7 @@ fi
# Define the identity of the package.
PACKAGE='libatomic_ops'
- VERSION='7.2alpha6'
+ VERSION='7.2alpha7'
cat >>confdefs.h <<_ACEOF
@@ -5384,7 +5384,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libatomic_ops $as_me 7.2alpha6, which was
+This file was extended by libatomic_ops $as_me 7.2alpha7, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5450,7 +5450,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libatomic_ops config.status 7.2alpha6
+libatomic_ops config.status 7.2alpha7
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 2d7d447..340b676 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([libatomic_ops],[7.2alpha6])
+AC_INIT([libatomic_ops],[7.2alpha7])
AC_CANONICAL_TARGET([])
AC_CONFIG_SRCDIR(src/atomic_ops.c)
AM_INIT_AUTOMAKE
diff --git a/doc/.cvsignore b/doc/.cvsignore
deleted file mode 100644
index f3c7a7c..0000000
--- a/doc/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/src/.cvsignore b/src/.cvsignore
deleted file mode 100644
index 655e9cf..0000000
--- a/src/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*.a
-*.o
-Makefile
-config.h
-config.h.in~
-stamp-h1
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ca41ff..91da77a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS=atomic_ops
AM_CFLAGS=@PICFLAG@
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
include_HEADERS=atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h
lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a
diff --git a/src/Makefile.in b/src/Makefile.in
index ff309fe..9fe367b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -245,6 +245,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = atomic_ops
AM_CFLAGS = @PICFLAG@
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
include_HEADERS = atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h
lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a
@NEED_ASM_FALSE@libatomic_ops_a_SOURCES = atomic_ops.c
diff --git a/src/atomic_ops/.cvsignore b/src/atomic_ops/.cvsignore
deleted file mode 100644
index f3c7a7c..0000000
--- a/src/atomic_ops/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/src/atomic_ops/sysdeps/.cvsignore b/src/atomic_ops/sysdeps/.cvsignore
deleted file mode 100644
index f3c7a7c..0000000
--- a/src/atomic_ops/sysdeps/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/src/atomic_ops/sysdeps/gcc/x86.h b/src/atomic_ops/sysdeps/gcc/x86.h
index 5e6d7fa..807afc1 100644
--- a/src/atomic_ops/sysdeps/gcc/x86.h
+++ b/src/atomic_ops/sysdeps/gcc/x86.h
@@ -104,16 +104,11 @@ AO_or_full (volatile AO_t *p, AO_t incr)
AO_INLINE AO_TS_VAL_t
AO_test_and_set_full(volatile AO_TS_t *addr)
{
-# ifdef AO_XCHGB_RET_WORD
- /* Workaround for a bug in LLVM v2.7 GAS. */
- unsigned oldval;
-# else
- unsigned char oldval;
-# endif
+ unsigned char oldval;
/* Note: the "xchg" instruction does not need a "lock" prefix */
__asm__ __volatile__("xchgb %0, %1"
: "=q"(oldval), "=m"(*addr)
- : "0"(0xff), "m"(*addr) : "memory");
+ : "0"((unsigned char)0xff), "m"(*addr) : "memory");
return (AO_TS_VAL_t)oldval;
}
#define AO_HAVE_test_and_set_full
diff --git a/src/atomic_ops/sysdeps/gcc/x86_64.h b/src/atomic_ops/sysdeps/gcc/x86_64.h
index 0f68c1e..3cbe76e 100644
--- a/src/atomic_ops/sysdeps/gcc/x86_64.h
+++ b/src/atomic_ops/sysdeps/gcc/x86_64.h
@@ -101,16 +101,11 @@ AO_or_full (volatile AO_t *p, AO_t incr)
AO_INLINE AO_TS_VAL_t
AO_test_and_set_full(volatile AO_TS_t *addr)
{
-# ifdef AO_XCHGB_RET_WORD
- /* Workaround for a bug in LLVM v2.7 GAS. */
- unsigned oldval;
-# else
- unsigned char oldval;
-# endif
+ unsigned char oldval;
/* Note: the "xchg" instruction does not need a "lock" prefix */
__asm__ __volatile__("xchgb %0, %1"
: "=q"(oldval), "=m"(*addr)
- : "0"(0xff), "m"(*addr) : "memory");
+ : "0"((unsigned char)0xff), "m"(*addr) : "memory");
return (AO_TS_VAL_t)oldval;
}
#define AO_HAVE_test_and_set_full
diff --git a/tests/.cvsignore b/tests/.cvsignore
deleted file mode 100644
index ba5a932..0000000
--- a/tests/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.o
-Makefile
-list_atomic.i
-test_atomic
-test_atomic_pthreads
-test_malloc
-test_stack
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5afb35..f23a9b6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,7 +6,7 @@ EXTRA_DIST=test_atomic.template list_atomic.template run_parallel.inc \
BUILT_SOURCES = test_atomic_include.h list_atomic.i
CLEANFILES = list_atomic.i
-AM_CPPFLAGS=-I$(srcdir)/../src
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
TESTS=test_atomic test_atomic_pthreads test_stack test_malloc
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 590e64a..481f4f4 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -194,7 +194,7 @@ EXTRA_DIST = test_atomic.template list_atomic.template run_parallel.inc \
# to regenerate them on Windows without sed.
BUILT_SOURCES = test_atomic_include.h list_atomic.i
CLEANFILES = list_atomic.i
-AM_CPPFLAGS = -I$(srcdir)/../src
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
test_atomic_SOURCES = test_atomic.c
test_atomic_LDADD = $(THREADDLLIBS) ../src/libatomic_ops.a
test_atomic_pthreads_SOURCES = test_atomic.c
diff --git a/tests/list_atomic.c b/tests/list_atomic.c
index 1faf5c4..a71a4af 100644
--- a/tests/list_atomic.c
+++ b/tests/list_atomic.c
@@ -6,17 +6,17 @@
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop)
"AO_nop(): ";
@@ -25,51 +25,48 @@ void list_atomic(void)
"No AO_nop";
# endif
# if defined(AO_HAVE_load)
- "AO_load(addr):";
- AO_load(addr);
+ "AO_load(&val):";
+ AO_load(&val);
# else
"No AO_load";
# endif
# if defined(AO_HAVE_store)
- "AO_store(addr, val):";
- AO_store(addr, val);
+ "AO_store(&val, newval):";
+ AO_store(&val, newval);
# else
"No AO_store";
# endif
# if defined(AO_HAVE_test_and_set)
- "AO_test_and_set(tsaddr):";
- AO_test_and_set(tsaddr);
+ "AO_test_and_set(&ts):";
+ AO_test_and_set(&ts);
# else
"No AO_test_and_set";
# endif
# if defined(AO_HAVE_fetch_and_add1)
- "AO_fetch_and_add1(addr):";
- AO_fetch_and_add1(addr);
+ "AO_fetch_and_add1(&val):";
+ AO_fetch_and_add1(&val);
# else
"No AO_fetch_and_add1";
# endif
# if defined(AO_HAVE_fetch_and_sub1)
- "AO_fetch_and_sub1(addr):";
- AO_fetch_and_sub1(addr);
+ "AO_fetch_and_sub1(&val):";
+ AO_fetch_and_sub1(&val);
# else
"No AO_fetch_and_sub1";
# endif
# if defined(AO_HAVE_fetch_and_add)
- "AO_fetch_and_add(addr, incr):";
- AO_fetch_and_add(addr, incr);
+ "AO_fetch_and_add(&val, incr):";
+ AO_fetch_and_add(&val, incr);
# else
"No AO_fetch_and_add";
# endif
# if defined(AO_HAVE_compare_and_swap)
- "AO_compare_and_swap(addr, oldval, newval):";
- AO_compare_and_swap(addr, oldval, newval);
+ "AO_compare_and_swap(&val, oldval, newval):";
+ AO_compare_and_swap(&val, oldval, newval);
# else
"No AO_compare_and_swap";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -77,17 +74,17 @@ void list_atomic(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_release(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_release)
"AO_nop_release(): ";
@@ -96,51 +93,48 @@ void list_atomic_release(void)
"No AO_nop_release";
# endif
# if defined(AO_HAVE_load_release)
- "AO_load_release(addr):";
- AO_load_release(addr);
+ "AO_load_release(&val):";
+ AO_load_release(&val);
# else
"No AO_load_release";
# endif
# if defined(AO_HAVE_store_release)
- "AO_store_release(addr, val):";
- AO_store_release(addr, val);
+ "AO_store_release(&val, newval):";
+ AO_store_release(&val, newval);
# else
"No AO_store_release";
# endif
# if defined(AO_HAVE_test_and_set_release)
- "AO_test_and_set_release(tsaddr):";
- AO_test_and_set_release(tsaddr);
+ "AO_test_and_set_release(&ts):";
+ AO_test_and_set_release(&ts);
# else
"No AO_test_and_set_release";
# endif
# if defined(AO_HAVE_fetch_and_add1_release)
- "AO_fetch_and_add1_release(addr):";
- AO_fetch_and_add1_release(addr);
+ "AO_fetch_and_add1_release(&val):";
+ AO_fetch_and_add1_release(&val);
# else
"No AO_fetch_and_add1_release";
# endif
# if defined(AO_HAVE_fetch_and_sub1_release)
- "AO_fetch_and_sub1_release(addr):";
- AO_fetch_and_sub1_release(addr);
+ "AO_fetch_and_sub1_release(&val):";
+ AO_fetch_and_sub1_release(&val);
# else
"No AO_fetch_and_sub1_release";
# endif
# if defined(AO_HAVE_fetch_and_add_release)
- "AO_fetch_and_add_release(addr, incr):";
- AO_fetch_and_add_release(addr, incr);
+ "AO_fetch_and_add_release(&val, incr):";
+ AO_fetch_and_add_release(&val, incr);
# else
"No AO_fetch_and_add_release";
# endif
# if defined(AO_HAVE_compare_and_swap_release)
- "AO_compare_and_swap_release(addr, oldval, newval):";
- AO_compare_and_swap_release(addr, oldval, newval);
+ "AO_compare_and_swap_release(&val, oldval, newval):";
+ AO_compare_and_swap_release(&val, oldval, newval);
# else
"No AO_compare_and_swap_release";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -148,17 +142,17 @@ void list_atomic_release(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_acquire(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_acquire)
"AO_nop_acquire(): ";
@@ -167,51 +161,48 @@ void list_atomic_acquire(void)
"No AO_nop_acquire";
# endif
# if defined(AO_HAVE_load_acquire)
- "AO_load_acquire(addr):";
- AO_load_acquire(addr);
+ "AO_load_acquire(&val):";
+ AO_load_acquire(&val);
# else
"No AO_load_acquire";
# endif
# if defined(AO_HAVE_store_acquire)
- "AO_store_acquire(addr, val):";
- AO_store_acquire(addr, val);
+ "AO_store_acquire(&val, newval):";
+ AO_store_acquire(&val, newval);
# else
"No AO_store_acquire";
# endif
# if defined(AO_HAVE_test_and_set_acquire)
- "AO_test_and_set_acquire(tsaddr):";
- AO_test_and_set_acquire(tsaddr);
+ "AO_test_and_set_acquire(&ts):";
+ AO_test_and_set_acquire(&ts);
# else
"No AO_test_and_set_acquire";
# endif
# if defined(AO_HAVE_fetch_and_add1_acquire)
- "AO_fetch_and_add1_acquire(addr):";
- AO_fetch_and_add1_acquire(addr);
+ "AO_fetch_and_add1_acquire(&val):";
+ AO_fetch_and_add1_acquire(&val);
# else
"No AO_fetch_and_add1_acquire";
# endif
# if defined(AO_HAVE_fetch_and_sub1_acquire)
- "AO_fetch_and_sub1_acquire(addr):";
- AO_fetch_and_sub1_acquire(addr);
+ "AO_fetch_and_sub1_acquire(&val):";
+ AO_fetch_and_sub1_acquire(&val);
# else
"No AO_fetch_and_sub1_acquire";
# endif
# if defined(AO_HAVE_fetch_and_add_acquire)
- "AO_fetch_and_add_acquire(addr, incr):";
- AO_fetch_and_add_acquire(addr, incr);
+ "AO_fetch_and_add_acquire(&val, incr):";
+ AO_fetch_and_add_acquire(&val, incr);
# else
"No AO_fetch_and_add_acquire";
# endif
# if defined(AO_HAVE_compare_and_swap_acquire)
- "AO_compare_and_swap_acquire(addr, oldval, newval):";
- AO_compare_and_swap_acquire(addr, oldval, newval);
+ "AO_compare_and_swap_acquire(&val, oldval, newval):";
+ AO_compare_and_swap_acquire(&val, oldval, newval);
# else
"No AO_compare_and_swap_acquire";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -219,17 +210,17 @@ void list_atomic_acquire(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_read(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_read)
"AO_nop_read(): ";
@@ -238,51 +229,48 @@ void list_atomic_read(void)
"No AO_nop_read";
# endif
# if defined(AO_HAVE_load_read)
- "AO_load_read(addr):";
- AO_load_read(addr);
+ "AO_load_read(&val):";
+ AO_load_read(&val);
# else
"No AO_load_read";
# endif
# if defined(AO_HAVE_store_read)
- "AO_store_read(addr, val):";
- AO_store_read(addr, val);
+ "AO_store_read(&val, newval):";
+ AO_store_read(&val, newval);
# else
"No AO_store_read";
# endif
# if defined(AO_HAVE_test_and_set_read)
- "AO_test_and_set_read(tsaddr):";
- AO_test_and_set_read(tsaddr);
+ "AO_test_and_set_read(&ts):";
+ AO_test_and_set_read(&ts);
# else
"No AO_test_and_set_read";
# endif
# if defined(AO_HAVE_fetch_and_add1_read)
- "AO_fetch_and_add1_read(addr):";
- AO_fetch_and_add1_read(addr);
+ "AO_fetch_and_add1_read(&val):";
+ AO_fetch_and_add1_read(&val);
# else
"No AO_fetch_and_add1_read";
# endif
# if defined(AO_HAVE_fetch_and_sub1_read)
- "AO_fetch_and_sub1_read(addr):";
- AO_fetch_and_sub1_read(addr);
+ "AO_fetch_and_sub1_read(&val):";
+ AO_fetch_and_sub1_read(&val);
# else
"No AO_fetch_and_sub1_read";
# endif
# if defined(AO_HAVE_fetch_and_add_read)
- "AO_fetch_and_add_read(addr, incr):";
- AO_fetch_and_add_read(addr, incr);
+ "AO_fetch_and_add_read(&val, incr):";
+ AO_fetch_and_add_read(&val, incr);
# else
"No AO_fetch_and_add_read";
# endif
# if defined(AO_HAVE_compare_and_swap_read)
- "AO_compare_and_swap_read(addr, oldval, newval):";
- AO_compare_and_swap_read(addr, oldval, newval);
+ "AO_compare_and_swap_read(&val, oldval, newval):";
+ AO_compare_and_swap_read(&val, oldval, newval);
# else
"No AO_compare_and_swap_read";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -290,17 +278,17 @@ void list_atomic_read(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_write(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_write)
"AO_nop_write(): ";
@@ -309,51 +297,48 @@ void list_atomic_write(void)
"No AO_nop_write";
# endif
# if defined(AO_HAVE_load_write)
- "AO_load_write(addr):";
- AO_load_write(addr);
+ "AO_load_write(&val):";
+ AO_load_write(&val);
# else
"No AO_load_write";
# endif
# if defined(AO_HAVE_store_write)
- "AO_store_write(addr, val):";
- AO_store_write(addr, val);
+ "AO_store_write(&val, newval):";
+ AO_store_write(&val, newval);
# else
"No AO_store_write";
# endif
# if defined(AO_HAVE_test_and_set_write)
- "AO_test_and_set_write(tsaddr):";
- AO_test_and_set_write(tsaddr);
+ "AO_test_and_set_write(&ts):";
+ AO_test_and_set_write(&ts);
# else
"No AO_test_and_set_write";
# endif
# if defined(AO_HAVE_fetch_and_add1_write)
- "AO_fetch_and_add1_write(addr):";
- AO_fetch_and_add1_write(addr);
+ "AO_fetch_and_add1_write(&val):";
+ AO_fetch_and_add1_write(&val);
# else
"No AO_fetch_and_add1_write";
# endif
# if defined(AO_HAVE_fetch_and_sub1_write)
- "AO_fetch_and_sub1_write(addr):";
- AO_fetch_and_sub1_write(addr);
+ "AO_fetch_and_sub1_write(&val):";
+ AO_fetch_and_sub1_write(&val);
# else
"No AO_fetch_and_sub1_write";
# endif
# if defined(AO_HAVE_fetch_and_add_write)
- "AO_fetch_and_add_write(addr, incr):";
- AO_fetch_and_add_write(addr, incr);
+ "AO_fetch_and_add_write(&val, incr):";
+ AO_fetch_and_add_write(&val, incr);
# else
"No AO_fetch_and_add_write";
# endif
# if defined(AO_HAVE_compare_and_swap_write)
- "AO_compare_and_swap_write(addr, oldval, newval):";
- AO_compare_and_swap_write(addr, oldval, newval);
+ "AO_compare_and_swap_write(&val, oldval, newval):";
+ AO_compare_and_swap_write(&val, oldval, newval);
# else
"No AO_compare_and_swap_write";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -361,17 +346,17 @@ void list_atomic_write(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_full(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_full)
"AO_nop_full(): ";
@@ -380,51 +365,48 @@ void list_atomic_full(void)
"No AO_nop_full";
# endif
# if defined(AO_HAVE_load_full)
- "AO_load_full(addr):";
- AO_load_full(addr);
+ "AO_load_full(&val):";
+ AO_load_full(&val);
# else
"No AO_load_full";
# endif
# if defined(AO_HAVE_store_full)
- "AO_store_full(addr, val):";
- AO_store_full(addr, val);
+ "AO_store_full(&val, newval):";
+ AO_store_full(&val, newval);
# else
"No AO_store_full";
# endif
# if defined(AO_HAVE_test_and_set_full)
- "AO_test_and_set_full(tsaddr):";
- AO_test_and_set_full(tsaddr);
+ "AO_test_and_set_full(&ts):";
+ AO_test_and_set_full(&ts);
# else
"No AO_test_and_set_full";
# endif
# if defined(AO_HAVE_fetch_and_add1_full)
- "AO_fetch_and_add1_full(addr):";
- AO_fetch_and_add1_full(addr);
+ "AO_fetch_and_add1_full(&val):";
+ AO_fetch_and_add1_full(&val);
# else
"No AO_fetch_and_add1_full";
# endif
# if defined(AO_HAVE_fetch_and_sub1_full)
- "AO_fetch_and_sub1_full(addr):";
- AO_fetch_and_sub1_full(addr);
+ "AO_fetch_and_sub1_full(&val):";
+ AO_fetch_and_sub1_full(&val);
# else
"No AO_fetch_and_sub1_full";
# endif
# if defined(AO_HAVE_fetch_and_add_full)
- "AO_fetch_and_add_full(addr, incr):";
- AO_fetch_and_add_full(addr, incr);
+ "AO_fetch_and_add_full(&val, incr):";
+ AO_fetch_and_add_full(&val, incr);
# else
"No AO_fetch_and_add_full";
# endif
# if defined(AO_HAVE_compare_and_swap_full)
- "AO_compare_and_swap_full(addr, oldval, newval):";
- AO_compare_and_swap_full(addr, oldval, newval);
+ "AO_compare_and_swap_full(&val, oldval, newval):";
+ AO_compare_and_swap_full(&val, oldval, newval);
# else
"No AO_compare_and_swap_full";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -432,17 +414,17 @@ void list_atomic_full(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_release_write(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_release_write)
"AO_nop_release_write(): ";
@@ -451,51 +433,48 @@ void list_atomic_release_write(void)
"No AO_nop_release_write";
# endif
# if defined(AO_HAVE_load_release_write)
- "AO_load_release_write(addr):";
- AO_load_release_write(addr);
+ "AO_load_release_write(&val):";
+ AO_load_release_write(&val);
# else
"No AO_load_release_write";
# endif
# if defined(AO_HAVE_store_release_write)
- "AO_store_release_write(addr, val):";
- AO_store_release_write(addr, val);
+ "AO_store_release_write(&val, newval):";
+ AO_store_release_write(&val, newval);
# else
"No AO_store_release_write";
# endif
# if defined(AO_HAVE_test_and_set_release_write)
- "AO_test_and_set_release_write(tsaddr):";
- AO_test_and_set_release_write(tsaddr);
+ "AO_test_and_set_release_write(&ts):";
+ AO_test_and_set_release_write(&ts);
# else
"No AO_test_and_set_release_write";
# endif
# if defined(AO_HAVE_fetch_and_add1_release_write)
- "AO_fetch_and_add1_release_write(addr):";
- AO_fetch_and_add1_release_write(addr);
+ "AO_fetch_and_add1_release_write(&val):";
+ AO_fetch_and_add1_release_write(&val);
# else
"No AO_fetch_and_add1_release_write";
# endif
# if defined(AO_HAVE_fetch_and_sub1_release_write)
- "AO_fetch_and_sub1_release_write(addr):";
- AO_fetch_and_sub1_release_write(addr);
+ "AO_fetch_and_sub1_release_write(&val):";
+ AO_fetch_and_sub1_release_write(&val);
# else
"No AO_fetch_and_sub1_release_write";
# endif
# if defined(AO_HAVE_fetch_and_add_release_write)
- "AO_fetch_and_add_release_write(addr, incr):";
- AO_fetch_and_add_release_write(addr, incr);
+ "AO_fetch_and_add_release_write(&val, incr):";
+ AO_fetch_and_add_release_write(&val, incr);
# else
"No AO_fetch_and_add_release_write";
# endif
# if defined(AO_HAVE_compare_and_swap_release_write)
- "AO_compare_and_swap_release_write(addr, oldval, newval):";
- AO_compare_and_swap_release_write(addr, oldval, newval);
+ "AO_compare_and_swap_release_write(&val, oldval, newval):";
+ AO_compare_and_swap_release_write(&val, oldval, newval);
# else
"No AO_compare_and_swap_release_write";
# endif
}
-
-
-
/*
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
*
@@ -503,17 +482,17 @@ void list_atomic_release_write(void)
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomic_acquire_read(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nop_acquire_read)
"AO_nop_acquire_read(): ";
@@ -522,48 +501,45 @@ void list_atomic_acquire_read(void)
"No AO_nop_acquire_read";
# endif
# if defined(AO_HAVE_load_acquire_read)
- "AO_load_acquire_read(addr):";
- AO_load_acquire_read(addr);
+ "AO_load_acquire_read(&val):";
+ AO_load_acquire_read(&val);
# else
"No AO_load_acquire_read";
# endif
# if defined(AO_HAVE_store_acquire_read)
- "AO_store_acquire_read(addr, val):";
- AO_store_acquire_read(addr, val);
+ "AO_store_acquire_read(&val, newval):";
+ AO_store_acquire_read(&val, newval);
# else
"No AO_store_acquire_read";
# endif
# if defined(AO_HAVE_test_and_set_acquire_read)
- "AO_test_and_set_acquire_read(tsaddr):";
- AO_test_and_set_acquire_read(tsaddr);
+ "AO_test_and_set_acquire_read(&ts):";
+ AO_test_and_set_acquire_read(&ts);
# else
"No AO_test_and_set_acquire_read";
# endif
# if defined(AO_HAVE_fetch_and_add1_acquire_read)
- "AO_fetch_and_add1_acquire_read(addr):";
- AO_fetch_and_add1_acquire_read(addr);
+ "AO_fetch_and_add1_acquire_read(&val):";
+ AO_fetch_and_add1_acquire_read(&val);
# else
"No AO_fetch_and_add1_acquire_read";
# endif
# if defined(AO_HAVE_fetch_and_sub1_acquire_read)
- "AO_fetch_and_sub1_acquire_read(addr):";
- AO_fetch_and_sub1_acquire_read(addr);
+ "AO_fetch_and_sub1_acquire_read(&val):";
+ AO_fetch_and_sub1_acquire_read(&val);
# else
"No AO_fetch_and_sub1_acquire_read";
# endif
# if defined(AO_HAVE_fetch_and_add_acquire_read)
- "AO_fetch_and_add_acquire_read(addr, incr):";
- AO_fetch_and_add_acquire_read(addr, incr);
+ "AO_fetch_and_add_acquire_read(&val, incr):";
+ AO_fetch_and_add_acquire_read(&val, incr);
# else
"No AO_fetch_and_add_acquire_read";
# endif
# if defined(AO_HAVE_compare_and_swap_acquire_read)
- "AO_compare_and_swap_acquire_read(addr, oldval, newval):";
- AO_compare_and_swap_acquire_read(addr, oldval, newval);
+ "AO_compare_and_swap_acquire_read(&val, oldval, newval):";
+ AO_compare_and_swap_acquire_read(&val, oldval, newval);
# else
"No AO_compare_and_swap_acquire_read";
# endif
}
-
-
-
diff --git a/tests/list_atomic.template b/tests/list_atomic.template
index a3d36e3..958e44f 100644
--- a/tests/list_atomic.template
+++ b/tests/list_atomic.template
@@ -5,17 +5,17 @@
* see doc/COPYING for details.
*/
-/* This generates a compilable program. But it is really meant to be */
-/* be used only with cc -E, to inspect the expensions generated by */
-/* primitives. */
+/* This generates a compilable program. But it is really meant to be */
+/* be used only with cc -E, to inspect the expensions generated by */
+/* primitives. */
-/* The result will not link or run. */
+/* The result will not link or run. */
void list_atomicXX(void)
{
- AO_T *addr, val, newval, oldval;
- AO_TS_T tsaddr;
- long incr;
+ AO_T val, newval = 0, oldval = 0;
+ AO_TS_T ts;
+ long incr = 0;
# if defined(AO_HAVE_nopXX)
"AO_nopXX(): ";
@@ -24,48 +24,45 @@ void list_atomicXX(void)
"No AO_nopXX";
# endif
# if defined(AO_HAVE_loadXX)
- "AO_loadXX(addr):";
- AO_loadXX(addr);
+ "AO_loadXX(&val):";
+ AO_loadXX(&val);
# else
"No AO_loadXX";
# endif
# if defined(AO_HAVE_storeXX)
- "AO_storeXX(addr, val):";
- AO_storeXX(addr, val);
+ "AO_storeXX(&val, newval):";
+ AO_storeXX(&val, newval);
# else
"No AO_storeXX";
# endif
# if defined(AO_HAVE_test_and_setXX)
- "AO_test_and_setXX(tsaddr):";
- AO_test_and_setXX(tsaddr);
+ "AO_test_and_setXX(&ts):";
+ AO_test_and_setXX(&ts);
# else
"No AO_test_and_setXX";
# endif
# if defined(AO_HAVE_fetch_and_add1XX)
- "AO_fetch_and_add1XX(addr):";
- AO_fetch_and_add1XX(addr);
+ "AO_fetch_and_add1XX(&val):";
+ AO_fetch_and_add1XX(&val);
# else
"No AO_fetch_and_add1XX";
# endif
# if defined(AO_HAVE_fetch_and_sub1XX)
- "AO_fetch_and_sub1XX(addr):";
- AO_fetch_and_sub1XX(addr);
+ "AO_fetch_and_sub1XX(&val):";
+ AO_fetch_and_sub1XX(&val);
# else
"No AO_fetch_and_sub1XX";
# endif
# if defined(AO_HAVE_fetch_and_addXX)
- "AO_fetch_and_addXX(addr, incr):";
- AO_fetch_and_addXX(addr, incr);
+ "AO_fetch_and_addXX(&val, incr):";
+ AO_fetch_and_addXX(&val, incr);
# else
"No AO_fetch_and_addXX";
# endif
# if defined(AO_HAVE_compare_and_swapXX)
- "AO_compare_and_swapXX(addr, oldval, newval):";
- AO_compare_and_swapXX(addr, oldval, newval);
+ "AO_compare_and_swapXX(&val, oldval, newval):";
+ AO_compare_and_swapXX(&val, oldval, newval);
# else
"No AO_compare_and_swapXX";
# endif
}
-
-
-
diff --git a/tests/run_parallel.inc b/tests/run_parallel.inc
index 1a87c8b..8c326ab 100644
--- a/tests/run_parallel.inc
+++ b/tests/run_parallel.inc
@@ -33,9 +33,17 @@
#include "atomic_ops.h"
+#ifndef _WIN64
+# define AO_PTRDIFF_T long
+#elif defined(__int64)
+# define AO_PTRDIFF_T __int64
+#else
+# define AO_PTRDIFF_T long long
+#endif
+
typedef void * (* thr_func)(void *);
-typedef int (* test_func)(void); /* Returns != 0 on success */
+typedef int (* test_func)(void); /* Returns != 0 on success */
void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name);
@@ -48,7 +56,7 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
int code;
fprintf(stderr, "Testing %s\n", name);
- if (nthreads > 100)
+ if (nthreads > 100)
{
fprintf(stderr, "run_parallel: requested too many threads\n");
abort();
@@ -59,7 +67,7 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
/* Increase it. */
if (pthread_default_stacksize_np(1024*1024, 0) != 0) {
fprintf(stderr, "pthread_default_stacksize_np failed. "
- "OK after first call.\n");
+ "OK after first call.\n");
}
# endif
@@ -68,19 +76,19 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
for (i = 0; i < nthreads; ++i)
{
if ((code = pthread_create(thr + i, &attr, f1, (void *)(long)i)) != 0)
- {
- perror("Thread creation failed");
- fprintf(stderr, "Pthread_create returned %d, thread %d\n", code, i);
- abort();
+ {
+ perror("Thread creation failed");
+ fprintf(stderr, "Pthread_create returned %d, thread %d\n", code, i);
+ abort();
}
}
for (i = 0; i < nthreads; ++i)
{
if ((code = pthread_join(thr[i], NULL)) != 0)
- {
- perror("Thread join failed");
- fprintf(stderr, "Pthread_join returned %d, thread %d\n", code, i);
- abort();
+ {
+ perror("Thread join failed");
+ fprintf(stderr, "Pthread_join returned %d, thread %d\n", code, i);
+ abort();
}
}
if (t())
@@ -103,7 +111,7 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
int i;
fprintf(stderr, "Testing %s\n", name);
- if (nthreads > 100)
+ if (nthreads > 100)
{
fprintf(stderr, "run_parallel: requested too many threads\n");
taskSuspend(0);
@@ -114,10 +122,10 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
thr[i] = taskSpawn((char*) name, 180, 0, 32768, (FUNCPTR) f1, i,
1, 2, 3, 4, 5, 6, 7, 8, 9);
if (thr[i] == ERROR)
- {
- fprintf(stderr, "taskSpawn failed with %d, thread %d\n",
- errno, i);
- taskSuspend(0);
+ {
+ fprintf(stderr, "taskSpawn failed with %d, thread %d\n",
+ errno, i);
+ taskSuspend(0);
}
}
for (i = 0; i < nthreads; ++i)
@@ -149,7 +157,7 @@ DWORD WINAPI tramp(LPVOID param)
{
struct tramp_args *args = (struct tramp_args *)param;
- return (DWORD)(args -> fn)((LPVOID)(args -> arg));
+ return (DWORD)(AO_PTRDIFF_T)(*args->fn)((LPVOID)(AO_PTRDIFF_T)args->arg);
}
void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
@@ -160,7 +168,7 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
DWORD code;
fprintf(stderr, "Testing %s\n", name);
- if (nthreads > 100)
+ if (nthreads > 100)
{
fprintf(stderr, "run_parallel: requested too many threads\n");
abort();
@@ -171,22 +179,22 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
args[i].fn = f1;
args[i].arg = i;
if ((thr[i] = CreateThread(NULL, 0, tramp, (LPVOID)(args+i), 0, NULL))
- == NULL)
- {
- perror("Thread creation failed");
- fprintf(stderr, "CreateThread failed with %d, thread %d\n",
- GetLastError(), i);
- abort();
+ == NULL)
+ {
+ perror("Thread creation failed");
+ fprintf(stderr, "CreateThread failed with %lu, thread %d\n",
+ (unsigned long)GetLastError(), i);
+ abort();
}
}
for (i = 0; i < nthreads; ++i)
{
if ((code = WaitForSingleObject(thr[i], INFINITE)) != WAIT_OBJECT_0)
- {
- perror("Thread join failed");
- fprintf(stderr, "WaitForSingleObject returned %d, thread %d\n",
- code, i);
- abort();
+ {
+ perror("Thread join failed");
+ fprintf(stderr, "WaitForSingleObject returned %lu, thread %d\n",
+ (unsigned long)code, i);
+ abort();
}
}
if (t())
@@ -201,4 +209,3 @@ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name)
return 0;
}
#endif /* USE_WINTHREADS */
-
diff --git a/tests/test_atomic.c b/tests/test_atomic.c
index d31297d..7d59393 100644
--- a/tests/test_atomic.c
+++ b/tests/test_atomic.c
@@ -1,11 +1,11 @@
-/*
+/*
* Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
* Original Author: Hans Boehm
*
* This file may be redistributed and/or modified under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2, or (at your option) any later version.
- *
+ *
* It is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License in the
@@ -40,7 +40,7 @@ AO_t counter = 0;
void * add1sub1_thr(void * id)
{
- int me = (int)(long)id;
+ int me = (int)(AO_PTRDIFF_T)id;
int i;
@@ -68,7 +68,7 @@ AO_t counter2 = 0;
void * acqrel_thr(void *id)
{
- int me = (int)(long)id;
+ int me = (int)(AO_PTRDIFF_T)id;
int i;
@@ -76,36 +76,36 @@ void * acqrel_thr(void *id)
if (me & 1)
{
AO_t my_counter1;
- if (me != 1)
- fprintf(stderr, "acqrel test: too many threads\n");
- my_counter1 = AO_load(&counter1);
- AO_store(&counter1, my_counter1 + 1);
- AO_store_release_write(&counter2, my_counter1 + 1);
+ if (me != 1)
+ fprintf(stderr, "acqrel test: too many threads\n");
+ my_counter1 = AO_load(&counter1);
+ AO_store(&counter1, my_counter1 + 1);
+ AO_store_release_write(&counter2, my_counter1 + 1);
}
else
{
- AO_t my_counter1a, my_counter2a;
- AO_t my_counter1b, my_counter2b;
-
- my_counter2a = AO_load_acquire_read(&counter2);
- my_counter1a = AO_load(&counter1);
- /* Redo this, to make sure that the second load of counter1 */
- /* is not viewed as a common subexpression. */
- my_counter2b = AO_load_acquire_read(&counter2);
- my_counter1b = AO_load(&counter1);
- if (my_counter1a < my_counter2a)
- {
- fprintf(stderr, "Saw release store out of order: %lu < %lu\n",
- (unsigned long)my_counter1a, (unsigned long)my_counter2a);
- abort();
- }
- if (my_counter1b < my_counter2b)
- {
- fprintf(stderr,
- "Saw release store out of order (bad CSE?): %lu < %lu\n",
- (unsigned long)my_counter1b, (unsigned long)my_counter2b);
- abort();
- }
+ AO_t my_counter1a, my_counter2a;
+ AO_t my_counter1b, my_counter2b;
+
+ my_counter2a = AO_load_acquire_read(&counter2);
+ my_counter1a = AO_load(&counter1);
+ /* Redo this, to make sure that the second load of counter1 */
+ /* is not viewed as a common subexpression. */
+ my_counter2b = AO_load_acquire_read(&counter2);
+ my_counter1b = AO_load(&counter1);
+ if (my_counter1a < my_counter2a)
+ {
+ fprintf(stderr, "Saw release store out of order: %lu < %lu\n",
+ (unsigned long)my_counter1a, (unsigned long)my_counter2a);
+ abort();
+ }
+ if (my_counter1b < my_counter2b)
+ {
+ fprintf(stderr,
+ "Saw release store out of order (bad CSE?): %lu < %lu\n",
+ (unsigned long)my_counter1b, (unsigned long)my_counter2b);
+ abort();
+ }
}
return 0;
@@ -136,7 +136,7 @@ void * test_and_set_thr(void * id)
if (locked_counter != 1)
{
fprintf(stderr, "Test and set failure 1, counter = %ld\n",
- locked_counter);
+ locked_counter);
abort();
}
locked_counter *= 2;
@@ -146,7 +146,7 @@ void * test_and_set_thr(void * id)
if (locked_counter != 1)
{
fprintf(stderr, "Test and set failure 2, counter = %ld\n",
- locked_counter);
+ locked_counter);
abort();
}
--locked_counter;
@@ -180,11 +180,11 @@ int main()
# endif
# if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read)
run_parallel(3, acqrel_thr, acqrel_test,
- "store_release_write/load_acquire_read");
+ "store_release_write/load_acquire_read");
# endif
# if defined(AO_HAVE_test_and_set_acquire)
run_parallel(5, test_and_set_thr, test_and_set_test,
- "test_and_set");
+ "test_and_set");
# endif
return 0;
}
diff --git a/tests/test_stack.c b/tests/test_stack.c
index a51d244..9b2e7b2 100644
--- a/tests/test_stack.c
+++ b/tests/test_stack.c
@@ -16,6 +16,17 @@
# include "config.h"
#endif
+#if defined(__vxworks) || defined(_MSC_VER) || defined(_WIN32_WINCE) \
+ || (defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__))
+
+ /* Skip the test if no pthreads. */
+ int main(void)
+ {
+ return 0;
+ }
+
+#else
+
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
@@ -239,3 +250,5 @@ int main(int argc, char **argv)
# endif /* !NO_TIMES */
return 0;
}
+
+#endif /* !_MSC_VER */