Workaround '#error' cppcheck error messages
authorIvan Maidanski <ivmai@mail.ru>
Wed, 5 Oct 2016 19:13:13 +0000 (22:13 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 5 Oct 2016 19:13:13 +0000 (22:13 +0300)
* src/atomic_ops.h [AO_REQUIRE_CAS && !AO_CAN_EMUL_CAS]: Skip #error
pragma if CPPCHECK.
* src/atomic_ops/generalize.h [AO_HAVE_nop_acquire]: Likewise.
* src/atomic_ops/generalize.h [AO_HAVE_nop_release]: Likewise.
* src/atomic_ops/sysdeps/armcc/arm_v6.h [__TARGET_ARCH_ARM < 6]:
Likewise.

src/atomic_ops.h
src/atomic_ops/generalize.h
src/atomic_ops/sysdeps/armcc/arm_v6.h
src/atomic_ops/sysdeps/msftc/x86.h
src/atomic_ops_stack.c

index f5b8145..277e7a3 100644 (file)
     && !defined(AO_HAVE_fetch_compare_and_swap_acquire)
 # if defined(AO_CAN_EMUL_CAS)
 #   include "atomic_ops/sysdeps/emul_cas.h"
-# else
-#  error Cannot implement AO_compare_and_swap_full on this architecture.
+# elif !defined(CPPCHECK)
+#   error Cannot implement AO_compare_and_swap_full on this architecture.
 # endif
 #endif /* AO_REQUIRE_CAS && !AO_HAVE_compare_and_swap ... */
 
index 6b17163..489f246 100644 (file)
 # define AO_HAVE_nop_full
 #endif
 
-#if defined(AO_HAVE_nop_acquire)
+#if defined(AO_HAVE_nop_acquire) && !defined(CPPCHECK)
 # error AO_nop_acquire is useless: do not define.
 #endif
-#if defined(AO_HAVE_nop_release)
+
+#if defined(AO_HAVE_nop_release) && !defined(CPPCHECK)
 # error AO_nop_release is useless: do not define.
 #endif
 
index c205deb..03aa1d6 100644 (file)
@@ -23,7 +23,9 @@
 #include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */
 
 #if __TARGET_ARCH_ARM < 6
-# error Do not use with ARM instruction sets lower than v6
+# if !defined(CPPCHECK)
+#   error Do not use with ARM instruction sets lower than v6
+# endif
 #else
 
 #define AO_ACCESS_CHECK_ALIGNED
index 7c2995a..0e26aaa 100644 (file)
@@ -103,8 +103,8 @@ AO_test_and_set_full(volatile AO_TS_t *addr)
 }
 #define AO_HAVE_test_and_set_full
 
-#ifdef _WIN64
-#  error wrong architecture
+#if defined(_WIN64) && !defined(CPPCHECK)
+# error wrong architecture
 #endif
 
 #ifdef AO_ASSUME_VISTA
index af34d4f..ad12f06 100644 (file)
@@ -240,7 +240,9 @@ AO_t *AO_stack_pop_acquire(AO_stack_t *list)
 
 /* Needed for future IA64 processors.  No current clients? */
 
+#if !defined(CPPCHECK)
 # error Untested!  Probably does not work.
+#endif
 
 /* We have a wide CAS, but only does an AO_t-wide comparison.   */
 /* We can't use the Treiber optimization, since we only check   */