@@ -24,10 +24,14 @@
#include "openvswitch/list.h"
/* "struct ovs_list" with pointers that will (probably) cause segfaults if
- * dereferenced and, better yet, show up clearly in a debugger. */
-#define OVS_LIST_POISON \
-(struct ovs_list) { (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL, \
- (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL }
+ * dereferenced and, better yet, show up clearly in a debugger.
+
+ * MSVC2015 doesn't support designated initializers when compiling C++,
+ * and doesn't support ternary operators with non-designated initializers.
+ * So we use these static definitions rather than using initializer macros. */
+static const struct ovs_list OVS_LIST_POISON =
+ { (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL,
+ (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL };
static inline void list_init(struct ovs_list *);
static inline void list_poison(struct ovs_list *);
The previous definitions of these variables using designated initializers caused a variety of issues when attempting to compile with MSVC, particularly if including these headers from C++ code. By defining them like this, we can appease MSVC and keep the definitions the same on all platforms. Suggested-by: Yin Lin <linyi@vmware.com> Signed-off-by: Nithin Raju <nithin@vmware.com> --- lib/list.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)