diff options
| author | Ivan Maidanski <ivmai@mail.ru> | 2016-10-17 08:22:53 +0300 |
|---|---|---|
| committer | Ivan Maidanski <ivmai@mail.ru> | 2016-10-17 08:22:53 +0300 |
| commit | 2798b417e18449b65d0c57122410b62bccbc66b4 (patch) | |
| tree | f806f21697bcf5c1570946b31d50c38d9793e0dc /tests | |
| parent | 7bceefbbd85a5b873e46299a4a55f50e2b56294a (diff) | |
| download | libatomic_ops-2798b417e18449b65d0c57122410b62bccbc66b4.tar.gz | |
Fix 'variable new value is never used' cppcheck style warning
Assertion for v value after fetch_and_sub1(&v) is added.
* tests/test_atomic_include.template (test_atomicXX): Call TA_assert
for s, b, zz values after they are decremented (use volatile pointer to
avoid "condition is always true" compiler warning).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_atomic_include.template | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test_atomic_include.template b/tests/test_atomic_include.template index d856cd6..6c11b1c 100644 --- a/tests/test_atomic_include.template +++ b/tests/test_atomic_include.template @@ -47,7 +47,7 @@ void test_atomicXX(void) # endif # if defined(AO_HAVE_storeXX) AO_storeXX(&x, 13); - TA_assert (x == 13); + TA_assert(x == 13); # else # if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ || !defined(AO_HAVE_store_release) \ @@ -129,6 +129,7 @@ void test_atomicXX(void) MISSING(AO_short_fetch_and_sub1); --s; # endif + TA_assert(*(volatile short *)&s == 13); # if defined(AO_HAVE_char_storeXX) AO_char_storeXX(&b, 13); # else @@ -166,6 +167,7 @@ void test_atomicXX(void) MISSING(AO_char_fetch_and_sub1); --b; # endif + TA_assert(*(volatile char *)&b == 13); # if defined(AO_HAVE_int_storeXX) AO_int_storeXX(&zz, 13); # else @@ -203,6 +205,7 @@ void test_atomicXX(void) MISSING(AO_int_fetch_and_sub1); --zz; # endif + TA_assert(*(volatile int *)&zz == 13); # if defined(AO_HAVE_compare_and_swapXX) TA_assert(!AO_compare_and_swapXX(&x, 14, 42)); TA_assert(x == 13); |
