From 457bc16e5514b7cdde175106807b3b4c04256209 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 24 Aug 2016 11:22:56 +0300 Subject: 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. --- tests/test_atomic_include.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') 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; -- cgit v1.2.1