From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 2807E68A1 for ; Wed, 26 Apr 2017 14:07:47 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id w64so48425811wma.0 for ; Wed, 26 Apr 2017 05:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mbbEvy3bWvZ4S4EYNerloIHSOs6hYpPLm5fihkFdKmE=; b=bXnLbkAqGibCZnvtulFdL4yslh8TuHvPV/kTzsYUXIAe/o3DkrCYAzuZczKiIqWxit 5OUCmPfhiMCPZCQ+Ta7epxMy56w5QPvRTuaTY2+GyAtmk+Ar1WxAG74KetKW29IKRi++ CPsPOPO9QhVOeIwe7QDMl3RHfP+kmakuehFnEmo+K9/lT4G7bawokrJf0bEN1r/AhFvC h9h3+jbuEAXGkDcm6TOomjzCrtVNjhRdC95aD2SO3UZ0IubBWOQ7Rrc8W8FxaW04cp9W hPjfEwkaosKjdRxNUks0PZOestYqykCzCiIMbYkSfv/5emKN7DaN7rQZCot77UK1EunD joOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mbbEvy3bWvZ4S4EYNerloIHSOs6hYpPLm5fihkFdKmE=; b=SUPF8frTD0/wFtlHBhSGU4WNZwOJ4ZrdwFtJDtUbAMOXH8/HIzAyyeDHAR569F4xPX KkEBpxycAWY/FDXtZi6XQxuFpc/k4kgzQyb2gB4qSxy7qH6CmS1IJmwsHQarhWgX4dMl bIUWZS6IZOQk8UfFq3VnA4+cULdtrfHzYh6Hc9xzAuTQEyyG5fqCOftze1Wur2EFfIVV OdMhaubhEJdV/wG/6RBb6KBhEI9BG9f+ztdO6eCQ+zuyI4QqRA6/0Xy7Q9g5NOoJegE7 BrJFdNWeA2gv6ArfWGoGtkwvHroR8yb26HFq4vUVT1Z4C05B7qRCErSDhJ08ttTMwx1W TYrA== X-Gm-Message-State: AN3rC/7mGhNEWb+I08C5sRbS7A0dKN5prDcMkpe5QrGxLvAFBItlrCvO +ljbZs2VX0h5mrA7 X-Received: by 10.28.222.70 with SMTP id v67mr4988455wmg.65.1493208466698; Wed, 26 Apr 2017 05:07:46 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id p17sm6542901wmd.11.2017.04.26.05.07.45 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 26 Apr 2017 05:07:46 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 26 Apr 2017 14:07:19 +0200 Message-Id: <2b65c2319ef695ae8b03ffc00accfa9116e9d9e5.1493208189.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 11/14] ethdev: fix C++ errors in flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 12:07:47 -0000 This commit addresses the following compilation errors: In file included from build/include/rte_flow_driver.h:50:0, from /tmp/check-includes.sh.1397.cc:1: build/include/rte_flow.h:428:2: error: expected primary-expression before '.' token [...] build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial designated initializers not supported [...] C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers. Considering that: - using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized) - using both initialization styles would be needlessly verbose - not exposing them at all would defeat their purpose - applications do not normally need these symbols at run time This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary. Fixes: 6de5c0f1302c ("ethdev: define default item masks in flow API") Cc: stable@dpdk.org Signed-off-by: Adrien Mazarguil Acked-by: Shahaf Shuler --- lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 7749491..bc7bc45 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -314,9 +314,11 @@ struct rte_flow_item_any { }; /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */ +#ifndef __cplusplus static const struct rte_flow_item_any rte_flow_item_any_mask = { .num = 0x00000000, }; +#endif /** * RTE_FLOW_ITEM_TYPE_VF @@ -341,9 +343,11 @@ struct rte_flow_item_vf { }; /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */ +#ifndef __cplusplus static const struct rte_flow_item_vf rte_flow_item_vf_mask = { .id = 0x00000000, }; +#endif /** * RTE_FLOW_ITEM_TYPE_PORT @@ -370,9 +374,11 @@ struct rte_flow_item_port { }; /** Default mask for RTE_FLOW_ITEM_TYPE_PORT. */ +#ifndef __cplusplus static const struct rte_flow_item_port rte_flow_item_port_mask = { .index = 0x00000000, }; +#endif /** * RTE_FLOW_ITEM_TYPE_RAW @@ -403,6 +409,7 @@ struct rte_flow_item_raw { }; /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */ +#ifndef __cplusplus static const struct rte_flow_item_raw rte_flow_item_raw_mask = { .relative = 1, .search = 1, @@ -411,6 +418,7 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { .limit = 0xffff, .length = 0xffff, }; +#endif /** * RTE_FLOW_ITEM_TYPE_ETH @@ -424,11 +432,13 @@ struct rte_flow_item_eth { }; /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */ +#ifndef __cplusplus static const struct rte_flow_item_eth rte_flow_item_eth_mask = { .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", .src.addr_bytes = "\xff\xff\xff\xff\xff\xff", .type = 0x0000, }; +#endif /** * RTE_FLOW_ITEM_TYPE_VLAN @@ -444,10 +454,12 @@ struct rte_flow_item_vlan { }; /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */ +#ifndef __cplusplus static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { .tpid = 0x0000, .tci = 0xffff, }; +#endif /** * RTE_FLOW_ITEM_TYPE_IPV4 @@ -461,12 +473,14 @@ struct rte_flow_item_ipv4 { }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ +#ifndef __cplusplus static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { .hdr = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_IPV6. @@ -480,6 +494,7 @@ struct rte_flow_item_ipv6 { }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ +#ifndef __cplusplus static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { .hdr = { .src_addr = @@ -490,6 +505,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { "\xff\xff\xff\xff\xff\xff\xff\xff", }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_ICMP. @@ -501,12 +517,14 @@ struct rte_flow_item_icmp { }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ +#ifndef __cplusplus static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { .hdr = { .icmp_type = 0xff, .icmp_code = 0xff, }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_UDP. @@ -518,12 +536,14 @@ struct rte_flow_item_udp { }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ +#ifndef __cplusplus static const struct rte_flow_item_udp rte_flow_item_udp_mask = { .hdr = { .src_port = 0xffff, .dst_port = 0xffff, }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_TCP. @@ -535,12 +555,14 @@ struct rte_flow_item_tcp { }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ +#ifndef __cplusplus static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { .hdr = { .src_port = 0xffff, .dst_port = 0xffff, }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_SCTP. @@ -552,12 +574,14 @@ struct rte_flow_item_sctp { }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ +#ifndef __cplusplus static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = { .hdr = { .src_port = 0xffff, .dst_port = 0xffff, }, }; +#endif /** * RTE_FLOW_ITEM_TYPE_VXLAN. @@ -572,9 +596,11 @@ struct rte_flow_item_vxlan { }; /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ +#ifndef __cplusplus static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { .vni = "\xff\xff\xff", }; +#endif /** * RTE_FLOW_ITEM_TYPE_E_TAG. -- 2.1.4