From patchwork Fri Mar 18 20:17:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Raju X-Patchwork-Id: 599665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qRc3g3kfdz9s4x for ; Sat, 19 Mar 2016 07:18:06 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 6EE3E10937; Fri, 18 Mar 2016 13:17:59 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 1902A10932 for ; Fri, 18 Mar 2016 13:17:58 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 697811E0393 for ; Fri, 18 Mar 2016 14:17:57 -0600 (MDT) X-ASG-Debug-ID: 1458332276-09eadd306160daa0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id SRq9aCwb853JAA9r (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Mar 2016 14:17:56 -0600 (MDT) X-Barracuda-Envelope-From: nithin@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO smtp-outbound-2.vmware.com) (208.91.2.13) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 18 Mar 2016 20:17:56 -0000 Received-SPF: error (mx1-pf2.cudamail.com: error in processing during lookup of vmware.com: DNS problem) X-Barracuda-Apparent-Source-IP: 208.91.2.13 X-Barracuda-RBL-IP: 208.91.2.13 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 05E1928756 for ; Fri, 18 Mar 2016 13:17:54 -0700 (PDT) Received: from pa-dbc1118.eng.vmware.com (unknown [10.162.210.18]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id E91B441215; Fri, 18 Mar 2016 13:17:54 -0700 (PDT) X-CudaMail-Envelope-Sender: nithin@vmware.com From: Nithin Raju To: dev@openvswitch.org, linyi@vmware.com X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-317072564 X-CudaMail-DTE: 031816 X-CudaMail-Originating-IP: 208.91.2.13 Date: Fri, 18 Mar 2016 13:17:54 -0700 X-ASG-Orig-Subj: [##CM-E2-317072564##][PATCH] list.h: Define OVS_LIST_POISON statically Message-Id: <1458332274-49510-1-git-send-email-nithin@vmware.com> X-Mailer: git-send-email 2.6.2 X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1458332276 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Subject: [ovs-dev] [PATCH] list.h: Define OVS_LIST_POISON statically X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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 Signed-off-by: Nithin Raju --- lib/list.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/list.h b/lib/list.h index f9c9d85..24c57ba 100644 --- a/lib/list.h +++ b/lib/list.h @@ -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 *);