From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shahaf Shuler Subject: Re: [PATCH v2 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE) Date: Tue, 25 Apr 2017 11:37:18 +0000 Message-ID: References: <384c50c8ea539fc02a133dbb9a0ec59e6036db54.1493108423.git.adrien.mazarguil@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Adrien Mazarguil , "dev@dpdk.org" Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0080.outbound.protection.outlook.com [104.47.0.80]) by dpdk.org (Postfix) with ESMTP id E344A2BA2 for ; Tue, 25 Apr 2017 13:37:21 +0200 (CEST) In-Reply-To: <384c50c8ea539fc02a133dbb9a0ec59e6036db54.1493108423.git.adrien.mazarguil@6wind.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tuesday, April 25, 2017 11:30 AM, Adrien Mazarguil: > This commit addresses the following compilation errors: >=20 > 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:631:1: error: C99 designator 'label_tc_s' outsi= de > aggregate initializer > [...] > build/include/rte_flow.h:631:1: error: initializer-string for array of > chars is too long [-fpermissive] > [...] > build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial > designated initializers not supported [...] >=20 > C++ does not support the C99-style designated initializers used in this > file for the default item masks. While the resulting symbols are primaril= y > useful to PMDs (written in C), they are exposed as part of the public API= for > documentation purposes and to assist application writers. >=20 > Considering that: >=20 > - 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 >=20 > This commit hides these symbols from C++ applications. Specific C++ > initializers will be added later if necessary. >=20 > Fixes: 7cd048321d1d ("ethdev: add MPLS and GRE flow API items") >=20 > Signed-off-by: Adrien Mazarguil > Acked-by: Beilei Xing Acked-by: Shahaf Shuler > --- > lib/librte_ether/rte_flow.h | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h in= dex > bc7bc45..abd4c6a 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -652,9 +652,11 @@ struct rte_flow_item_mpls { }; >=20 > /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */ > +#ifndef __cplusplus > static const struct rte_flow_item_mpls rte_flow_item_mpls_mask =3D { > .label_tc_s =3D "\xff\xff\xf0", > }; > +#endif >=20 > /** > * RTE_FLOW_ITEM_TYPE_GRE. > @@ -671,9 +673,11 @@ struct rte_flow_item_gre { }; >=20 > /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */ > +#ifndef __cplusplus > static const struct rte_flow_item_gre rte_flow_item_gre_mask =3D { > .protocol =3D 0xffff, > }; > +#endif >=20 > /** > * Matching pattern item definition. > -- > 2.1.4