From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <adrien.mazarguil@6wind.com>
Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51])
 by dpdk.org (Postfix) with ESMTP id 4CB995A8D
 for <dev@dpdk.org>; Mon, 24 Apr 2017 17:53:32 +0200 (CEST)
Received: by mail-wm0-f51.google.com with SMTP id u65so400416wmu.1
 for <dev@dpdk.org>; Mon, 24 Apr 2017 08:53:32 -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=JWrsDiY2BVlGHA/o9+max33Wrqa1wxQNnwANpM+gIdU=;
 b=YD545WNaClnl6QpbX0cTPPcidfRuGXfIhIPtvm/W5wb4QKcsGd1AZPI5eELqPg4hVP
 4H6lNrG4H7mqnWEJZ5D+Jqc2cf79yNTD2y7jCkDRz5uueGynWj8TJ6omH9iWkA94hygT
 uHFMp7AUGGF5dtosRcq0aGs6B7zhD1R5z15jVcswxL5M2LHrl+NxfkVAK1lW24ajwFZR
 NPfzRhcMm97kQBUjREoCWfQi5TSnWeW3EnK9bKkq/lkeTqSg5Ah3wp4Z+pj8DoRwUVic
 sUE97wvbqQ3Dm+bawk5PbwAqAfHPY5wegVs3mS3pRCKvpoJ7o7LEsMEozmpy2xs74a3Y
 TI/w==
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=JWrsDiY2BVlGHA/o9+max33Wrqa1wxQNnwANpM+gIdU=;
 b=UObus/2yf1E8zQvaCRN5n+TKgcauFqFvncozaow7ANfqzavsTyGzq8AhdCGkz7/vnp
 L/8+494LKUZPVc6GFD+1Xbjc0efAN2tTYKE54GrV6jwF+tNM2XU9XNWMNrgVC/5H1yg9
 ke0bIgLWpZprAJtcWV3zhKouq/dIboZl5FGAEI2Dsy00bbxvXyRDEW3SUgT/0aGfDiGl
 2b8yGKMd9aKeZ83NumA0K9P+y82GOla75rhms02MWfes0GF5ICjBudijkmJsOJqkxplP
 Ub3xoXPzGHRtaqkPFw3s+Qqrh2DYykCqVyvUgPg703A6yt/Xg7NjUOG0dKfSGALVRQaJ
 TPNg==
X-Gm-Message-State: AN3rC/7A5DaI2FuBvbeu4q4ytgV1jZPDdYZfDBS9b2aA+jjJ3pqYU74o
 H4/JhOZ6GqBegzUa
X-Received: by 10.28.154.85 with SMTP id c82mr10295423wme.100.1493049211903;
 Mon, 24 Apr 2017 08:53:31 -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 o77sm22999687wrc.38.2017.04.24.08.53.30
 (version=TLS1_2 cipher=AES128-SHA bits=128/128);
 Mon, 24 Apr 2017 08:53:30 -0700 (PDT)
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Cc: Beilei Xing <beilei.xing@intel.com>
Date: Mon, 24 Apr 2017 17:53:06 +0200
Message-Id: <7bcb59287ddea099179915808ecf056be62ad742.1493048352.git.adrien.mazarguil@6wind.com>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <cover.1493048352.git.adrien.mazarguil@6wind.com>
References: <cover.1493048352.git.adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH 12/13] ethdev: fix C++ errors in flow API (MPLS,
	GRE)
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 24 Apr 2017 15:53:32 -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:631:1: error: C99 designator 'label_tc_s' outside
    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
 [...]

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: 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")

Cc: Beilei Xing <beilei.xing@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 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 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
-- 
2.1.4