DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3 11/14] ethdev: fix C++ errors in flow API
Date: Wed, 26 Apr 2017 14:07:19 +0200	[thread overview]
Message-ID: <2b65c2319ef695ae8b03ffc00accfa9116e9d9e5.1493208189.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1493208189.git.adrien.mazarguil@6wind.com>

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 <adrien.mazarguil@6wind.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 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

  parent reply	other threads:[~2017-04-26 12:07 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 15:52 [dpdk-dev] [PATCH 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-24 15:52 ` [dpdk-dev] [PATCH 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-24 15:52 ` [dpdk-dev] [PATCH 02/13] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-24 15:52 ` [dpdk-dev] [PATCH 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:52 ` [dpdk-dev] [PATCH 04/13] net: fix missing include " Adrien Mazarguil
2017-04-24 15:52 ` [dpdk-dev] [PATCH 05/13] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25  2:15   ` Yuanhan Liu
2017-04-26  7:32   ` Maxime Coquelin
2017-04-24 15:53 ` [dpdk-dev] [PATCH 06/13] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:53 ` [dpdk-dev] [PATCH 07/13] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-24 16:19   ` Legacy, Allain
2017-04-24 15:53 ` [dpdk-dev] [PATCH 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-24 15:53 ` [dpdk-dev] [PATCH 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-24 15:53 ` [dpdk-dev] [PATCH 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-24 15:53 ` [dpdk-dev] [PATCH 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-24 15:53 ` [dpdk-dev] [PATCH 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-25  1:18   ` Xing, Beilei
2017-04-24 15:53 ` [dpdk-dev] [PATCH 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25  8:29 ` [dpdk-dev] [PATCH v2 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-25  8:29   ` [dpdk-dev] [PATCH v2 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-25 15:38     ` Zhang, Roy Fan
2017-04-25  8:29   ` [dpdk-dev] [PATCH v2 02/13] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25 15:31     ` De Lara Guarch, Pablo
2017-04-26  7:06       ` Adrien Mazarguil
2017-04-25  8:29   ` [dpdk-dev] [PATCH v2 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-25  8:29   ` [dpdk-dev] [PATCH v2 04/13] net: fix missing include " Adrien Mazarguil
2017-04-25 16:13     ` Singh, Jasvinder
2017-04-25  8:29   ` [dpdk-dev] [PATCH v2 05/13] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 06/13] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-25  9:56     ` Olivier Matz
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 07/13] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-25 12:31     ` Legacy, Allain
2017-04-25 12:49       ` Adrien Mazarguil
2017-04-25 13:00         ` Legacy, Allain
2017-04-25 14:48           ` Adrien Mazarguil
2017-04-25 14:54             ` Legacy, Allain
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-25 11:35     ` [dpdk-dev] [dpdk-stable] " Shahaf Shuler
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-25 11:37     ` Shahaf Shuler
2017-04-25  8:30   ` [dpdk-dev] [PATCH v2 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25 10:04   ` [dpdk-dev] [PATCH v2 00/13] Fixes for exported headers Ferruh Yigit
2017-04-26 12:07   ` [dpdk-dev] [PATCH v3 00/14] " Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 01/14] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 02/14] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-26 14:47       ` Jerin Jacob
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 03/14] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 04/14] net: fix missing include " Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 05/14] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 06/14] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 07/14] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 08/14] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 09/14] efd: fix missing include " Adrien Mazarguil
2017-04-26 15:36       ` De Lara Guarch, Pablo
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 10/14] metrics: fix errors " Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` Adrien Mazarguil [this message]
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 12/14] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 13/14] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-27  1:03       ` Lu, Wenzhuo
2017-04-26 12:07     ` [dpdk-dev] [PATCH v3 14/14] eal: fix debug macro redefinition Adrien Mazarguil
2017-04-30 22:13     ` [dpdk-dev] [PATCH v3 00/14] Fixes for exported headers Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b65c2319ef695ae8b03ffc00accfa9116e9d9e5.1493208189.git.adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).