summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-07-24 12:56:47 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-09-20 10:50:16 +0300
commitbd17b1885d46caed7bac7015cbf2fb5e369e7822 (patch)
tree0c6266156686e29e8cc7194cf3cefaf554a2b017 /tests
parent6306d4d049f084ffe30ca0bc7221361f71729e75 (diff)
downloadlibatomic_ops-bd17b1885d46caed7bac7015cbf2fb5e369e7822.tar.gz
Workaround 'unused result' code defects in list_atomic.template
* tests/list_atomic.template: Include stdlib.h (needed for exit() prototype). * tests/list_atomic.template [AO_HAVE_XSIZE_loadXX] (XSIZE_list_atomicXX): Cast AO_XSIZE_loadXX() result to void. * tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_addXX]: Cast AO_XSIZE_fetch_and_addXX() result to void. * tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_add1XX] (XSIZE_list_atomicXX): Cast AO_XSIZE_fetch_and_add1XX() result to void. * tests/list_atomic.template [AO_HAVE_XSIZE_fetch_and_sub1XX] (XSIZE_list_atomicXX): Cast AO_XSIZE_fetch_and_sub1XX() result to void. * tests/list_atomic.template [AO_HAVE_test_and_setXX] (XSIZE_list_atomicXX): Cast AO_test_and_setXX() result to void. * tests/list_atomic.template [AO_HAVE_XSIZE_compare_and_swapXX] (XSIZE_list_atomicXX): Call exit(1) if AO_XSIZE_compare_and_swapXX failed. * tests/list_atomic.template [AO_HAVE_XSIZE_fetch_compare_and_swapXX] (XSIZE_list_atomicXX): Call exit(1) if AO_XSIZE_fetch_compare_and_swapXX failed.
Diffstat (limited to 'tests')
-rw-r--r--tests/list_atomic.template18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/list_atomic.template b/tests/list_atomic.template
index 3e748f4..e613158 100644
--- a/tests/list_atomic.template
+++ b/tests/list_atomic.template
@@ -11,6 +11,8 @@
/* The result will not link or run. */
+#include <stdlib.h> /* for exit() */
+
void XSIZE_list_atomicXX(void)
{
# if defined(AO_HAVE_XSIZE_loadXX) || defined(AO_HAVE_XSIZE_storeXX) \
@@ -47,7 +49,7 @@ void XSIZE_list_atomicXX(void)
# ifdef AO_HAVE_XSIZE_loadXX
(void)"AO_XSIZE_loadXX(&val):";
- AO_XSIZE_loadXX(&val);
+ (void)AO_XSIZE_loadXX(&val);
# else
(void)"No AO_XSIZE_loadXX";
# endif
@@ -59,19 +61,19 @@ void XSIZE_list_atomicXX(void)
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_addXX
(void)"AO_XSIZE_fetch_and_addXX(&val, incr):";
- AO_XSIZE_fetch_and_addXX(&val, incr);
+ (void)AO_XSIZE_fetch_and_addXX(&val, incr);
# else
(void)"No AO_XSIZE_fetch_and_addXX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_add1XX
(void)"AO_XSIZE_fetch_and_add1XX(&val):";
- AO_XSIZE_fetch_and_add1XX(&val);
+ (void)AO_XSIZE_fetch_and_add1XX(&val);
# else
(void)"No AO_XSIZE_fetch_and_add1XX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_sub1XX
(void)"AO_XSIZE_fetch_and_sub1XX(&val):";
- AO_XSIZE_fetch_and_sub1XX(&val);
+ (void)AO_XSIZE_fetch_and_sub1XX(&val);
# else
(void)"No AO_XSIZE_fetch_and_sub1XX";
# endif
@@ -95,7 +97,8 @@ void XSIZE_list_atomicXX(void)
# endif
# ifdef AO_HAVE_XSIZE_compare_and_swapXX
(void)"AO_XSIZE_compare_and_swapXX(&val, oldval, newval):";
- AO_XSIZE_compare_and_swapXX(&val, oldval, newval);
+ if (!AO_XSIZE_compare_and_swapXX(&val, oldval, newval))
+ exit(1);
# else
(void)"No AO_XSIZE_compare_and_swapXX";
# endif
@@ -103,14 +106,15 @@ void XSIZE_list_atomicXX(void)
/* TODO: Add AO_compare_and_swap_doubleXX */
# 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);
+ if (AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval) != oldval)
+ exit(1);
# else
(void)"No AO_XSIZE_fetch_compare_and_swapXX";
# endif
# if defined(AO_HAVE_test_and_setXX)
(void)"AO_test_and_setXX(&ts):";
- AO_test_and_setXX(&ts);
+ (void)AO_test_and_setXX(&ts);
# else
(void)"No AO_test_and_setXX";
# endif