diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2013-08-11 11:33:12 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-08-11 14:28:10 +0400 |
commit | 71e2004376e06303c182069546ebc80c51cb0ec5 (patch) | |
tree | 6534c533bf2980b9c9f08a2b89161ce99fdb476d /tests/list_atomic.template | |
parent | 9e217ec3e527e5ff544a40049c33e3c8d3bb391b (diff) | |
download | libatomic_ops-71e2004376e06303c182069546ebc80c51cb0ec5.tar.gz |
list_atomic: Add makefile rule to test list_atomic.template syntax
* tests/Makefile.am (BUILT_SOURCES, CLEANFILES): Add "list_atomic.o".
* tests/Makefile.am (list_atomic.o): New rule (to verify list_atomic.c
is valid C code).
* tests/list_atomic.template (list_atomicXX): Use "volatile" for "val"
local variable.
* tests/list_atomic.template (list_atomicXX): Define "oldval", "newval",
"ts" and "incr" local variables only if used; cast string literals to
void (to prevent compiler warnings).
* tests/list_atomic.template (list_atomicXX): Use AO_t type for "incr"
local variable instead of C long type.
* tests/list_atomic.template (list_atomicXX): Define "oldval",
"newval", "incr" as statitc local variables, and remove explicit
initialization to zero (to void problems with initialization of these
variables for AO_double_t case if the latter is a struct).
Diffstat (limited to 'tests/list_atomic.template')
-rw-r--r-- | tests/list_atomic.template | 69 |
1 files changed, 41 insertions, 28 deletions
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 } |