]> granicus.if.org Git - libatomic_ops/commitdiff
Workaround 'function is never used' cppcheck style warnings
authorIvan Maidanski <ivmai@mail.ru>
Tue, 25 Oct 2016 07:13:35 +0000 (10:13 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 25 Oct 2016 07:14:05 +0000 (10:14 +0300)
* src/atomic_ops.h [AO_CAN_EMUL_CAS]: Include emul_cas.h also if
CPPCHECK (to define AO_store_full as AO_store_full_emulation).
* tests/test_atomic_include.template [CPPCHECK] (list_atomicXX,
char_list_atomicXX, short_list_atomicXX, int_list_atomicXX,
double_list_atomicXX): Declare function.
* tests/test_atomic_include.template test_atomicXX (test_atomicXX):
Call list_atomicXX, char_list_atomicXX, short_list_atomicXX,
int_list_atomicXX and double_list_atomicXX if CPPCHECK.

src/atomic_ops.h
tests/test_atomic_include.template

index 277e7a38f67aa4b843ede9e707db3d4b69861937..993dd4263e505e43bc0e6a720270a729bb353309 100644 (file)
 # define AO_CAN_EMUL_CAS
 #endif
 
-#if defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \
+#if (defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \
     && !defined(AO_HAVE_fetch_compare_and_swap) \
     && !defined(AO_HAVE_compare_and_swap_full) \
     && !defined(AO_HAVE_fetch_compare_and_swap_full) \
     && !defined(AO_HAVE_compare_and_swap_acquire) \
-    && !defined(AO_HAVE_fetch_compare_and_swap_acquire)
+    && !defined(AO_HAVE_fetch_compare_and_swap_acquire)) || defined(CPPCHECK)
 # if defined(AO_CAN_EMUL_CAS)
 #   include "atomic_ops/sysdeps/emul_cas.h"
 # elif !defined(CPPCHECK)
index 6c11b1cb7fa6c6512d35b98fafb364950e9696fc..7db587956cabf5911c5c9d7d07f5029853f99e74 100644 (file)
 #define MISSING(name) \
   printf("Missing: %s\n", #name "XX")
 
+#if defined(CPPCHECK)
+  void list_atomicXX(void);
+  void char_list_atomicXX(void);
+  void short_list_atomicXX(void);
+  void int_list_atomicXX(void);
+  void double_list_atomicXX(void);
+#endif
+
 void test_atomicXX(void)
 {
   AO_t x;
@@ -39,6 +47,13 @@ void test_atomicXX(void)
     w.AO_val2 = 0;
 # endif
 
+# if defined(CPPCHECK)
+    list_atomicXX();
+    char_list_atomicXX();
+    short_list_atomicXX();
+    int_list_atomicXX();
+    double_list_atomicXX();
+# endif
 # if defined(AO_HAVE_nopXX)
     AO_nopXX();
 # elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \