diff options
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/list_atomic.template | 69 |
2 files changed, 48 insertions, 31 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 66f83bb..88a43b9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,8 +3,8 @@ EXTRA_DIST=test_atomic_include.template list_atomic.template run_parallel.h \ # We distribute test_atomic_include.h and list_atomic.c, since it is hard # to regenerate them on Windows without sed. -BUILT_SOURCES = test_atomic_include.h list_atomic.i -CLEANFILES = list_atomic.i +BUILT_SOURCES = test_atomic_include.h list_atomic.i list_atomic.o +CLEANFILES = list_atomic.i list_atomic.o AM_CPPFLAGS = \ -I$(top_builddir)/src -I$(top_srcdir)/src \ @@ -56,4 +56,8 @@ list_atomic.c: list_atomic.template sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c - $(COMPILE) $? -E > list_atomic.i + $(COMPILE) $? -E > $@ + +# Verify list_atomic.c syntax: +list_atomic.o: list_atomic.c + $(COMPILE) -c -o $@ $? diff --git a/tests/list_atomic.template b/tests/list_atomic.template index 744cbc8..6cd6bed 100644 --- a/tests/list_atomic.template +++ b/tests/list_atomic.template @@ -13,63 +13,76 @@ void list_atomicXX(void) { - AO_t val; - AO_t newval = 0, oldval = 0; - AO_TS_t ts; - long incr = 0; + volatile AO_t val; +# if defined(AO_HAVE_compare_and_swapXX) \ + || defined(AO_HAVE_fetch_compare_and_swapXX) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_storeXX) || defined(AO_HAVE_compare_and_swapXX) \ + || defined(AO_HAVE_fetch_compare_and_swapXX) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_setXX) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_addXX) + static AO_t incr /* = 0 */; +# endif # if defined(AO_HAVE_nopXX) - "AO_nopXX(): "; + (void)"AO_nopXX(): "; AO_nopXX(); # else - "No AO_nopXX"; + (void)"No AO_nopXX"; # endif + # if defined(AO_HAVE_loadXX) - "AO_loadXX(&val):"; + (void)"AO_loadXX(&val):"; AO_loadXX(&val); # else - "No AO_loadXX"; + (void)"No AO_loadXX"; # endif # if defined(AO_HAVE_storeXX) - "AO_storeXX(&val, newval):"; + (void)"AO_storeXX(&val, newval):"; AO_storeXX(&val, newval); # else - "No AO_storeXX"; + (void)"No AO_storeXX"; # endif -# if defined(AO_HAVE_test_and_setXX) - "AO_test_and_setXX(&ts):"; - AO_test_and_setXX(&ts); +# if defined(AO_HAVE_fetch_and_addXX) + (void)"AO_fetch_and_addXX(&val, incr):"; + AO_fetch_and_addXX(&val, incr); # else - "No AO_test_and_setXX"; + (void)"No AO_fetch_and_addXX"; # endif # if defined(AO_HAVE_fetch_and_add1XX) - "AO_fetch_and_add1XX(&val):"; + (void)"AO_fetch_and_add1XX(&val):"; AO_fetch_and_add1XX(&val); # else - "No AO_fetch_and_add1XX"; + (void)"No AO_fetch_and_add1XX"; # endif # if defined(AO_HAVE_fetch_and_sub1XX) - "AO_fetch_and_sub1XX(&val):"; + (void)"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(&val, incr):"; - AO_fetch_and_addXX(&val, incr); -# else - "No AO_fetch_and_addXX"; + (void)"No AO_fetch_and_sub1XX"; # endif # if defined(AO_HAVE_compare_and_swapXX) - "AO_compare_and_swapXX(&val, oldval, newval):"; + (void)"AO_compare_and_swapXX(&val, oldval, newval):"; AO_compare_and_swapXX(&val, oldval, newval); # else - "No AO_compare_and_swapXX"; + (void)"No AO_compare_and_swapXX"; # endif # if defined(AO_HAVE_fetch_compare_and_swapXX) - "AO_fetch_compare_and_swapXX(&val, oldval, newval):"; + (void)"AO_fetch_compare_and_swapXX(&val, oldval, newval):"; AO_fetch_compare_and_swapXX(&val, oldval, newval); # else - "No AO_fetch_compare_and_swapXX"; + (void)"No AO_fetch_compare_and_swapXX"; +# endif + +# if defined(AO_HAVE_test_and_setXX) + (void)"AO_test_and_setXX(&ts):"; + AO_test_and_setXX(&ts); +# else + (void)"No AO_test_and_setXX"; # endif } |