Eliminate 'function is never used' cppcheck warning for load_before_cas
authorIvan Maidanski <ivmai@mail.ru>
Thu, 28 Dec 2017 18:09:25 +0000 (21:09 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 5 Mar 2018 21:35:13 +0000 (00:35 +0300)
(fix commit 441415c8)

* src/atomic_ops_stack.c [!AO_USE_ALMOST_LOCK_FREE
&& AO_THREAD_SANITIZER && !AO_HAVE_compare_and_swap_double &&
!AO_HAVE_compare_double_and_swap_double] (load_before_cas): Define as
macro (not as a static function).

src/atomic_ops_stack.c

index 11d385e..6008b89 100644 (file)
@@ -225,7 +225,9 @@ AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a)
 
 /* The functionality is the same as of AO_load_next but the atomicity   */
 /* is not needed.  The usage is similar to that of store_before_cas.    */
-#ifdef AO_THREAD_SANITIZER
+#if defined(AO_THREAD_SANITIZER) \
+    && (defined(AO_HAVE_compare_and_swap_double) \
+        || defined(AO_HAVE_compare_double_and_swap_double))
   /* TODO: If compiled by Clang (as of clang-4.0) with -O3 flag,        */
   /* no_sanitize attribute is ignored unless the argument is volatile.  */
 # if defined(__clang__)