Unfortunately starting from VS 2015, the "C" definition for `offsetof`
has been changed. Please see:
https://stackoverflow.com/questions/42725929/using-offsetof-with-enum-does-not-compile-in-visual-studio-2015/42726424

Several people reported the bug for 2015 and also 2017 (i.e. :
https://developercommunity.visualstudio.com/content/problem/22196/static-assert-cannot-compile-constexprs-method-tha.html
), but we don't have a fix yet.

This patch adds an explicit compare, although we could redefine the macro
for the same effect.

Signed-off-by: Alin Gabriel Serdean <[email protected]>
---
 include/openvswitch/ofp-actions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/openvswitch/ofp-actions.h 
b/include/openvswitch/ofp-actions.h
index 03c1d11..25f61ef 100644
--- a/include/openvswitch/ofp-actions.h
+++ b/include/openvswitch/ofp-actions.h
@@ -1128,7 +1128,7 @@ void *ofpact_finish(struct ofpbuf *, struct ofpact *);
     BUILD_ASSERT_DECL(offsetof(struct STRUCT, ofpact) == 0);            \
                                                                         \
     enum { OFPACT_##ENUM##_SIZE                                         \
-           = (offsetof(struct STRUCT, MEMBER)                           \
+           = (offsetof(struct STRUCT, MEMBER) != 0                      \
               ? offsetof(struct STRUCT, MEMBER)                         \
               : OFPACT_ALIGN(sizeof(struct STRUCT))) };                 \
                                                                         \
-- 
2.10.2.windows.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to