From patchwork Wed Nov 1 17:19:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin-Gabriel Serdean X-Patchwork-Id: 833054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yRw4d3sQTz9sDB for ; Thu, 2 Nov 2017 04:21:53 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 528D1C9E; Wed, 1 Nov 2017 17:19:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A2327C13 for ; Wed, 1 Nov 2017 17:19:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 45EDF47D for ; Wed, 1 Nov 2017 17:19:35 +0000 (UTC) X-Originating-IP: 89.46.161.178 Received: from localhost.localdomain (unknown [89.46.161.178]) (Authenticated sender: aserdean@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B08641720AC; Wed, 1 Nov 2017 18:19:33 +0100 (CET) From: Alin Gabriel Serdean To: dev@openvswitch.org Date: Wed, 1 Nov 2017 19:19:07 +0200 Message-Id: <20171101171907.14588-5-aserdean@ovn.org> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20171101171907.14588-1-aserdean@ovn.org> References: <20171101171907.14588-1-aserdean@ovn.org> X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Alin Gabriel Serdean Subject: [ovs-dev] [PATCH 4/4] ofp-actions: Add compare to offsetof need for MSVC 2015/17 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Acked-by: Ben Pfaff Acked-by: Anand Kumar --- 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))) }; \ \