From patchwork Mon Jul 31 02:54:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 795522 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 3xLPFd2nd9z9sRr for ; Mon, 31 Jul 2017 12:55:15 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 220A68A1; Mon, 31 Jul 2017 02:55:11 +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 92755414 for ; Mon, 31 Jul 2017 02:55:10 +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 E8DE93FC for ; Mon, 31 Jul 2017 02:55:09 +0000 (UTC) Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 42C331720A1; Mon, 31 Jul 2017 04:55:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 9J7woM0BHGXW; Mon, 31 Jul 2017 04:55:06 +0200 (CEST) X-Originating-IP: 173.228.112.34 Received: from sigabrt.gateway.sonic.net (173-228-112-34.dsl.dynamic.fusionbroadband.com [173.228.112.34]) (Authenticated sender: blp@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 3B5FD17209A; Mon, 31 Jul 2017 04:55:04 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Sun, 30 Jul 2017 19:54:56 -0700 Message-Id: <20170731025500.16294-1-blp@ovn.org> X-Mailer: git-send-email 2.10.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 1/5] ofp-actions: Add casts to placate C++ compilers. 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 C++ does not allow for an implicit conversion from void * to pointer to object or incomplete type. Signed-off-by: Ben Pfaff Acked-by: Russell Bryant --- include/openvswitch/ofp-actions.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 7b4aa9201d9b..00dde7c89e8d 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -195,7 +195,8 @@ BUILD_ASSERT_DECL(sizeof(struct ofpact) == 4); static inline struct ofpact * ofpact_next(const struct ofpact *ofpact) { - return (void *) ((uint8_t *) ofpact + OFPACT_ALIGN(ofpact->len)); + return ALIGNED_CAST(struct ofpact *, + (uint8_t *) ofpact + OFPACT_ALIGN(ofpact->len)); } struct ofpact *ofpact_next_flattened(const struct ofpact *); @@ -203,7 +204,7 @@ struct ofpact *ofpact_next_flattened(const struct ofpact *); static inline struct ofpact * ofpact_end(const struct ofpact *ofpacts, size_t ofpacts_len) { - return (void *) ((uint8_t *) ofpacts + ofpacts_len); + return ALIGNED_CAST(struct ofpact *, (uint8_t *) ofpacts + ofpacts_len); } static inline const struct ofpact * @@ -1103,8 +1104,8 @@ void *ofpact_finish(struct ofpbuf *, struct ofpact *); static inline struct STRUCT * \ ofpact_put_##ENUM(struct ofpbuf *ofpacts) \ { \ - return ofpact_put(ofpacts, OFPACT_##ENUM, \ - OFPACT_##ENUM##_SIZE); \ + return (struct STRUCT *) ofpact_put(ofpacts, OFPACT_##ENUM, \ + OFPACT_##ENUM##_SIZE); \ } \ \ static inline void \ @@ -1119,7 +1120,7 @@ void *ofpact_finish(struct ofpbuf *, struct ofpact *); { \ struct ofpact *ofpact = &(*ofpactp)->ofpact; \ ovs_assert(ofpact->type == OFPACT_##ENUM); \ - *ofpactp = ofpact_finish(ofpbuf, ofpact); \ + *ofpactp = (struct STRUCT *) ofpact_finish(ofpbuf, ofpact); \ } OFPACTS #undef OFPACT