From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <adrien.mazarguil@6wind.com>
Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com
 [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 4C6A75A98
 for <dev@dpdk.org>; Tue, 25 Apr 2017 10:30:27 +0200 (CEST)
Received: by mail-wr0-f176.google.com with SMTP id l50so30627296wrc.3
 for <dev@dpdk.org>; Tue, 25 Apr 2017 01:30:27 -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=aficcx05wG+PTKF/xvA22qaZJqNP+2xt5Zk/7cIFpX8=;
 b=yKDYh5aQdvk9nPlAJ1msmNxQCv8d8u2QRXVb7Jt79kqjJy44/A4Ky4tT2S7iMLRJSl
 NFIqSCu2GWFr7Rupa2VqMA+XEglqOZL6EdQ1HeyFH+TiUH0MXGUOrAlaYAqnMzRV9tD3
 OeLsH2zm6cWEt5jfgF605SAyg9/TRHA0i1bJtVJ8Dq0Yzlwz0wFv5ClIH4XWrrxSCICa
 EPzs8xXCC0VfkjCoRreMu8XkmHqerQtlJZQ/5aCxvkJO6VyGDpca7z9kxxskdxJIdCNp
 BMBv7v9tEG8JFQYhegR5+ImYagtXwSIdfYI7AZokO4KArOm+SGBOvcrHrJ4UATbl0cIX
 2Xgg==
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=aficcx05wG+PTKF/xvA22qaZJqNP+2xt5Zk/7cIFpX8=;
 b=JHhxaywYhNpKg4Rny5D4RfkYIGRkFPOKqhWDpG99AYiXMUIVW0S27VAh11uHlFtWws
 pYNvrs+g3sqNCTRDhI0zMUHqMVdvaqLxC20MnczzVCA/X6+4ADkkN+pObk0wn7Oh2qbm
 06Z59vQ2vHZnCX8sa/spOVeMSkB3O0Q8MXSgaUMyCrc0XIgzeDLDAHQFlG0QAjSqI/b2
 EmlB8Ver4r5U+XewpShb5Sh8lgtopTpOMHH3RaGAYIwsdpaKHekm4R9XoW6l5UHX57jX
 /eYstk9nqN0iWshg7YII4Oq6/PcwxtDX82VyaGaZphHiOjXc4qtFGGqPHokqhmUtPMBr
 mNTg==
X-Gm-Message-State: AN3rC/7U7/029aN/8hO4z2VRxcJRJrvTlt9THG4J1BiPpLdObn9kpl6c
 T7cskRkHApyJGy5dX9I=
X-Received: by 10.223.147.225 with SMTP id 88mr9056483wrp.146.1493109026821;
 Tue, 25 Apr 2017 01:30:26 -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 75sm4342530wmp.2.2017.04.25.01.30.25
 (version=TLS1_2 cipher=AES128-SHA bits=128/128);
 Tue, 25 Apr 2017 01:30:26 -0700 (PDT)
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Cc: Allain Legacy <allain.legacy@windriver.com>
Date: Tue, 25 Apr 2017 10:30:01 +0200
Message-Id: <046efd0fda00bfb5253586319fb9cfbf904a8f0a.1493108423.git.adrien.mazarguil@6wind.com>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <cover.1493108423.git.adrien.mazarguil@6wind.com>
References: <cover.1493048352.git.adrien.mazarguil@6wind.com>
 <cover.1493108423.git.adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH v2 07/13] net/avp: fix errors in exported headers
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: Tue, 25 Apr 2017 08:30:28 -0000

This commit addresses several errors related to missing includes such as:

 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_fifo.h:77:22: error: 'struct rte_avp_fifo' declared
    inside parameter list [-Werror]
 [...]
 build/include/rte_avp_fifo.h: In function 'avp_fifo_init':
 build/include/rte_avp_fifo.h:81:3: error: implicit declaration of function
    'rte_panic' [-Werror=implicit-function-declaration]
 [...]
 build/include/rte_avp_fifo.h:83:6: error: dereferencing pointer to
    incomplete type
 [...]
 build/include/rte_avp_fifo.h:109:2: error: implicit declaration of
    function 'rte_wmb' [-Werror=implicit-function-declaration]
 [...]
 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_common.h:104:2: error: unknown type name 'uint64_t'
 [...]
 build/include/rte_avp_common.h:386:15: error: 'ETHER_ADDR_LEN' undeclared
    here (not in a function)
 [...]

It addresses errors with strict compilation flags:

 In file included from /tmp/check-includes.sh.15315.c:1:0:
 build/include/rte_avp_common.h:122:3: error: ISO C99 doesn't support
    unnamed structs/unions [-Werror=pedantic]
 [...]
 build/include/rte_avp_common.h:136:17: error: ISO C forbids zero-size
    array 'buffer' [-Werror=pedantic]
 [...]

And also adds C++ awareness to both header files.

Fixes: 8e680655e205 ("net/avp: add public header files")

Cc: Allain Legacy <allain.legacy@windriver.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/avp/rte_avp_common.h | 17 ++++++++++++++++-
 drivers/net/avp/rte_avp_fifo.h   | 12 ++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/net/avp/rte_avp_common.h b/drivers/net/avp/rte_avp_common.h
index 31d763e..05093ad 100644
--- a/drivers/net/avp/rte_avp_common.h
+++ b/drivers/net/avp/rte_avp_common.h
@@ -57,8 +57,18 @@
 #ifndef _RTE_AVP_COMMON_H_
 #define _RTE_AVP_COMMON_H_
 
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
+#else
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
 #endif
 
 /**
@@ -115,6 +125,7 @@ struct rte_avp_device_config {
  */
 struct rte_avp_request {
 	uint32_t req_id; /**< Request id */
+	RTE_STD_C11
 	union {
 		uint32_t new_mtu; /**< New MTU */
 		uint8_t if_up;	/**< 1: interface up, 0: interface down */
@@ -133,7 +144,7 @@ struct rte_avp_fifo {
 	volatile unsigned int read; /**< Next position to be read */
 	unsigned int len; /**< Circular buffer length */
 	unsigned int elem_size; /**< Pointer size - for 32/64 bit OS */
-	void *volatile buffer[0]; /**< The buffer contains mbuf pointers */
+	void *volatile buffer[]; /**< The buffer contains mbuf pointers */
 };
 
 
@@ -413,4 +424,8 @@ struct rte_avp_device_info {
 #define RTE_AVP_IOCTL_RELEASE _IOWR(0, 3, struct rte_avp_device_info)
 #define RTE_AVP_IOCTL_QUERY   _IOWR(0, 4, struct rte_avp_device_config)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_COMMON_H_ */
diff --git a/drivers/net/avp/rte_avp_fifo.h b/drivers/net/avp/rte_avp_fifo.h
index 8262e4f..a0a37eb 100644
--- a/drivers/net/avp/rte_avp_fifo.h
+++ b/drivers/net/avp/rte_avp_fifo.h
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
+#include <rte_avp_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __KERNEL__
 /* Write memory barrier for kernel compiles */
 #define AVP_WMB() smp_wmb()
@@ -70,6 +76,8 @@
 #endif
 
 #ifndef __KERNEL__
+#include <rte_debug.h>
+
 /**
  * Initializes the avp fifo structure
  */
@@ -154,4 +162,8 @@ avp_fifo_free_count(struct rte_avp_fifo *fifo)
 	return (fifo->read - fifo->write - 1) & (fifo->len - 1);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_FIFO_H_ */
-- 
2.1.4