[lttng-dev] [PATCH 1/3] urcu: avoid "expression result unused" from clang

Lai Jiangshan laijs at cn.fujitsu.com
Fri Dec 7 04:24:53 EST 2012


The last expression result is unused and clang will complain.
The trick in the patch supresses the complaint

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
 urcu/system.h        |    5 ++++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/urcu/system.h b/urcu/system.h
index 2a45f22..6b7b0af 100644
--- a/urcu/system.h
+++ b/urcu/system.h
@@ -46,12 +46,15 @@
 /*
  * Store v into x, where x is located in shared memory. Performs the
  * required cache flush after writing. Returns v.
+ * "_w" here avoids the warning from clang:
+ * 	warning: expression result unused [-Wunused-value]
  */
 #define CMM_STORE_SHARED(x, v)		\
 	({				\
 		__typeof__(x) _v = _CMM_STORE_SHARED(x, v);	\
+		__typeof__(x) _w;	\
 		cmm_smp_wmc();		\
-		_v;			\
+		_w = _v;		\
 	})
 
 #endif /* _URCU_SYSTEM_H */
-- 
1.7.4.4




More information about the lttng-dev mailing list