From 43058b343cc48084972fb6d49d0783d58d5ffcf1 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 11 Aug 2013 14:49:05 +0400 Subject: [PATCH] tests: Parameterize list_atomic template with XSIZE * tests/Makefile.am (list_atomic.c): Substitute XSIZE/XCTYPE for AO_t. * tests/list_atomic.template (list_atomicXX): Parameterize with XSIZE and XCTYPE (except for AO_nop and AO_test_and_set). --- tests/Makefile.am | 16 ++++---- tests/list_atomic.template | 77 +++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 88a43b9..f044c37 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,14 +46,14 @@ test_atomic_include.h: test_atomic_include.template list_atomic.c: list_atomic.template echo "#include \"atomic_ops.h\" " > $@ - sed -e s/XX// $? >> $@ - sed -e s/XX/_release/ $? >> $@ - sed -e s/XX/_acquire/ $? >> $@ - sed -e s/XX/_read/ $? >> $@ - sed -e s/XX/_write/ $? >> $@ - sed -e s/XX/_full/ $? >> $@ - sed -e s/XX/_release_write/ $? >> $@ - sed -e s/XX/_acquire_read/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX// $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_release/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_acquire/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_read/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_write/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_full/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_release_write/ $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c $(COMPILE) $? -E > $@ diff --git a/tests/list_atomic.template b/tests/list_atomic.template index 6cd6bed..8817c6e 100644 --- a/tests/list_atomic.template +++ b/tests/list_atomic.template @@ -11,22 +11,23 @@ /* The result will not link or run. */ -void list_atomicXX(void) +void XSIZE_list_atomicXX(void) { - volatile AO_t val; -# if defined(AO_HAVE_compare_and_swapXX) \ - || defined(AO_HAVE_fetch_compare_and_swapXX) - static AO_t oldval /* = 0 */; + volatile XCTYPE val; +# if defined(AO_HAVE_XSIZE_compare_and_swapXX) \ + || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX) + static XCTYPE 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 */; +# if defined(AO_HAVE_XSIZE_storeXX) \ + || defined(AO_HAVE_XSIZE_compare_and_swapXX) \ + || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX) + static XCTYPE 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 */; +# if defined(AO_HAVE_XSIZE_fetch_and_addXX) + static XCTYPE incr /* = 0 */; # endif # if defined(AO_HAVE_nopXX) @@ -36,47 +37,47 @@ void list_atomicXX(void) (void)"No AO_nopXX"; # endif -# if defined(AO_HAVE_loadXX) - (void)"AO_loadXX(&val):"; - AO_loadXX(&val); +# ifdef AO_HAVE_XSIZE_loadXX + (void)"AO_XSIZE_loadXX(&val):"; + AO_XSIZE_loadXX(&val); # else - (void)"No AO_loadXX"; + (void)"No AO_XSIZE_loadXX"; # endif -# if defined(AO_HAVE_storeXX) - (void)"AO_storeXX(&val, newval):"; - AO_storeXX(&val, newval); +# ifdef AO_HAVE_XSIZE_storeXX + (void)"AO_XSIZE_storeXX(&val, newval):"; + AO_XSIZE_storeXX(&val, newval); # else - (void)"No AO_storeXX"; + (void)"No AO_XSIZE_storeXX"; # endif -# if defined(AO_HAVE_fetch_and_addXX) - (void)"AO_fetch_and_addXX(&val, incr):"; - AO_fetch_and_addXX(&val, incr); +# ifdef AO_HAVE_XSIZE_fetch_and_addXX + (void)"AO_XSIZE_fetch_and_addXX(&val, incr):"; + AO_XSIZE_fetch_and_addXX(&val, incr); # else - (void)"No AO_fetch_and_addXX"; + (void)"No AO_XSIZE_fetch_and_addXX"; # endif -# if defined(AO_HAVE_fetch_and_add1XX) - (void)"AO_fetch_and_add1XX(&val):"; - AO_fetch_and_add1XX(&val); +# ifdef AO_HAVE_XSIZE_fetch_and_add1XX + (void)"AO_XSIZE_fetch_and_add1XX(&val):"; + AO_XSIZE_fetch_and_add1XX(&val); # else - (void)"No AO_fetch_and_add1XX"; + (void)"No AO_XSIZE_fetch_and_add1XX"; # endif -# if defined(AO_HAVE_fetch_and_sub1XX) - (void)"AO_fetch_and_sub1XX(&val):"; - AO_fetch_and_sub1XX(&val); +# ifdef AO_HAVE_XSIZE_fetch_and_sub1XX + (void)"AO_XSIZE_fetch_and_sub1XX(&val):"; + AO_XSIZE_fetch_and_sub1XX(&val); # else - (void)"No AO_fetch_and_sub1XX"; + (void)"No AO_XSIZE_fetch_and_sub1XX"; # endif -# if defined(AO_HAVE_compare_and_swapXX) - (void)"AO_compare_and_swapXX(&val, oldval, newval):"; - AO_compare_and_swapXX(&val, oldval, newval); +# ifdef AO_HAVE_XSIZE_compare_and_swapXX + (void)"AO_XSIZE_compare_and_swapXX(&val, oldval, newval):"; + AO_XSIZE_compare_and_swapXX(&val, oldval, newval); # else - (void)"No AO_compare_and_swapXX"; + (void)"No AO_XSIZE_compare_and_swapXX"; # endif -# if defined(AO_HAVE_fetch_compare_and_swapXX) - (void)"AO_fetch_compare_and_swapXX(&val, oldval, newval):"; - AO_fetch_compare_and_swapXX(&val, oldval, newval); +# ifdef AO_HAVE_XSIZE_fetch_compare_and_swapXX + (void)"AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval):"; + AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval); # else - (void)"No AO_fetch_compare_and_swapXX"; + (void)"No AO_XSIZE_fetch_compare_and_swapXX"; # endif # if defined(AO_HAVE_test_and_setXX) -- 2.40.0