[ovs-dev] [PATCH 1/2] atomic: Suppress sparse warning.

Ethan Jackson ethan at nicira.com
Tue Jul 9 17:16:35 UTC 2013


With the latest version of sparse, the ATOMIC_VAR_INIT macro
generates the following warning.  This patch suppresses it.

warning: Using plain integer as NULL pointer

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 lib/ovs-atomic-pthreads.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/ovs-atomic-pthreads.h b/lib/ovs-atomic-pthreads.h
index 2f47a9c..e6f3f1a 100644
--- a/lib/ovs-atomic-pthreads.h
+++ b/lib/ovs-atomic-pthreads.h
@@ -80,7 +80,11 @@ typedef enum {
     memory_order_seq_cst
 } memory_order;
 
+#if __CHECKER__
+#define ATOMIC_VAR_INIT(VALUE) { .value = VALUE }
+#else
 #define ATOMIC_VAR_INIT(VALUE) { VALUE, PTHREAD_MUTEX_INITIALIZER }
+#endif
 #define atomic_init(OBJECT, VALUE)                      \
     ((OBJECT)->value = (VALUE),                         \
      pthread_mutex_init(&(OBJECT)->mutex, NULL),        \
-- 
1.7.9.5




More information about the dev mailing list