Acked-by: Eitan Eliahu <[email protected]>

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gurucharan Shetty
Sent: Monday, September 15, 2014 10:36 AM
To: [email protected]
Cc: Gurucharan Shetty
Subject: [ovs-dev] [PATCH 4/4] ovs-atomic-msvc: Disable a compiler warning.

MSVC does not support c11 style atomics for the C compiler.
Windows has different InterLocked* functions for different data sizes.  
ovs-atomic-msvc.h maps the api in ovs-atomic.h (which is similar to c11 
atomics) to the available atomic functions in Windows. In some cases, this 
causes compiler warnings about mismatched data sizes because the generated code 
has 'if else' conditions on different data sizes and proper casting is not 
possible.

In current OVS code base, we get one compiler warning through ovs-rcu.h which 
says "‘void *’ differs in levels of indirection from LONGLONG."
This comes from the following in ovs-atomic-msvc.h for atomic_read64():
*(DST) = InterlockedOr64((int64_t volatile *) (SRC), 0); when *DST is a void 
pointer (because InterLockedOr64 returns LONGLONG).
But this code path is only every hit for 64 bit data. So it should be safe to 
disable the warning. (Any real bugs in api calls would hopefully be caught 
while compiling on Linux using gcc/clang).

Signed-off-by: Gurucharan Shetty <[email protected]>
---
 lib/ovs-atomic-msvc.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ovs-atomic-msvc.h b/lib/ovs-atomic-msvc.h index 
11f5ad2..e8e4891 100644
--- a/lib/ovs-atomic-msvc.h
+++ b/lib/ovs-atomic-msvc.h
@@ -154,7 +154,10 @@ atomic_signal_fence(memory_order order)
     if (((size_t) (SRC) & (sizeof *(SRC) - 1)) == 0) {                     \
         *(DST) = *(SRC);                                                   \
     } else {                                                               \
+    __pragma (warning(push))                                               \
+    __pragma (warning(disable:4047))                                       \
        *(DST) = InterlockedOr64((int64_t volatile *) (SRC), 0);            \
+    __pragma (warning(pop))                                                \
     }
 
 #define atomic_read(SRC, DST)                               \
--
1.7.9.5

_______________________________________________
dev mailing list
[email protected]
https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yTvML8OxA42Jb6ViHe7fUXbvPVOYDPVq87w43doxtlY%3D%0A&m=LTLCGxbBwtVWHd4CpE1c%2BEexQO67%2BiyF%2Ba6R8acUumQ%3D%0A&s=f089dc9d797922130e5981e9e3fd16613d8b6b18de173ec63b37c96c7ab04595
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to