summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-10-05 22:13:13 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-10-05 22:13:13 +0300
commit11f324ee661d7a7ba1933f74430fe1ae14648e40 (patch)
tree1fd282a1a6f728703391170d04f1681e93f27509
parent2f18c21601472fac497d9d6bd3f5881ad75254ce (diff)
downloadlibatomic_ops-11f324ee661d7a7ba1933f74430fe1ae14648e40.tar.gz
Workaround '#error' cppcheck error messages
* 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.
-rw-r--r--src/atomic_ops.h4
-rw-r--r--src/atomic_ops/generalize.h5
-rw-r--r--src/atomic_ops/sysdeps/armcc/arm_v6.h4
-rw-r--r--src/atomic_ops/sysdeps/msftc/x86.h4
-rw-r--r--src/atomic_ops_stack.c2
5 files changed, 12 insertions, 7 deletions
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index f5b8145..277e7a3 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -371,8 +371,8 @@
&& !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 ... */
diff --git a/src/atomic_ops/generalize.h b/src/atomic_ops/generalize.h
index 6b17163..489f246 100644
--- a/src/atomic_ops/generalize.h
+++ b/src/atomic_ops/generalize.h
@@ -187,10 +187,11 @@
# 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
diff --git a/src/atomic_ops/sysdeps/armcc/arm_v6.h b/src/atomic_ops/sysdeps/armcc/arm_v6.h
index c205deb..03aa1d6 100644
--- a/src/atomic_ops/sysdeps/armcc/arm_v6.h
+++ b/src/atomic_ops/sysdeps/armcc/arm_v6.h
@@ -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
diff --git a/src/atomic_ops/sysdeps/msftc/x86.h b/src/atomic_ops/sysdeps/msftc/x86.h
index 7c2995a..0e26aaa 100644
--- a/src/atomic_ops/sysdeps/msftc/x86.h
+++ b/src/atomic_ops/sysdeps/msftc/x86.h
@@ -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
diff --git a/src/atomic_ops_stack.c b/src/atomic_ops_stack.c
index af34d4f..ad12f06 100644
--- a/src/atomic_ops_stack.c
+++ b/src/atomic_ops_stack.c
@@ -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 */