summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-08-24 11:22:56 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-08-24 11:22:56 +0300
commit457bc16e5514b7cdde175106807b3b4c04256209 (patch)
treed9fbfc733f2cda99958e817dc2b936768a5f52df /tests
parentf1c482eaf49ac1d122759a437c60d07282aa126e (diff)
downloadlibatomic_ops-457bc16e5514b7cdde175106807b3b4c04256209.tar.gz
Workaround 'condition always true', 'unused stored value' cppcheck warnings
* tests/test_atomic_include.template (test_atomicXX): Treat "x" variable as volatile one to suppress cppcheck warning that x==13 is always true. * tests/test_atomic_include.template (test_atomicXX): Make TA_assert(x==117) unconditional to suppress cppcheck warning that the value assigned by x=117 is never used.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_atomic_include.template4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_atomic_include.template b/tests/test_atomic_include.template
index 06894cd..d856cd6 100644
--- a/tests/test_atomic_include.template
+++ b/tests/test_atomic_include.template
@@ -210,7 +210,7 @@ void test_atomicXX(void)
TA_assert(x == 42);
# else
MISSING(AO_compare_and_swap);
- if (x == 13) x = 42;
+ if (*(volatile AO_t *)&x == 13) x = 42;
# endif
# if defined(AO_HAVE_orXX)
AO_orXX(&x, 66);
@@ -237,11 +237,11 @@ void test_atomicXX(void)
TA_assert(AO_fetch_compare_and_swapXX(&x, 14, 117) == 25);
TA_assert(x == 25);
TA_assert(AO_fetch_compare_and_swapXX(&x, 25, 117) == 25);
- TA_assert(x == 117);
# else
MISSING(AO_fetch_compare_and_swap);
if (x == 25) x = 117;
# endif
+ TA_assert(x == 117);
# if defined(AO_HAVE_double_loadXX)
old_w.AO_val1 = 3316;
old_w.AO_val2 = 2921;