All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [PATCH v3 05/14] vhost: fix errors with strict compilation flags
Date: Wed, 26 Apr 2017 14:07:13 +0200	[thread overview]
Message-ID: <f8efa0f4f078468447546d9622348e9f17baff3e.1493208189.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1493208189.git.adrien.mazarguil@6wind.com>

Exported headers must allow compilation with the strictest flags. This
commit addresses the following errors:

 In file included from /tmp/check-includes.sh.20132.c:1:0:
 build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
    'regions' [-Werror=pedantic]
 [...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with
  exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h
from now on since the Linux headers they depend on are not clean enough:

 In file included from /usr/include/linux/vhost.h:17:0,
                  from build/include/rte_vhost.h:43,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/virtio_ring.h: In function 'vring_init':
 /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
    used in arithmetic [-Werror=pointer-arith]
 [...]
 In file included from build/include/rte_vhost.h:43:0,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/vhost.h: At top level:
 /usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
    structs/unions [-Werror=pedantic]
 [...]

Fixes: eb32247457fe ("vhost: export guest memory regions")
Fixes: a798beb47c8e ("vhost: rename header file")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 devtools/check-includes.sh   |  4 +++-
 lib/librte_vhost/rte_vhost.h | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/devtools/check-includes.sh b/devtools/check-includes.sh
index d65adc6..c4ec73f 100755
--- a/devtools/check-includes.sh
+++ b/devtools/check-includes.sh
@@ -109,10 +109,12 @@ include_dir=${1:-build/include}
 	'rte_byteorder_64.h' \
 	'generic/*' \
 	'exec-env/*' \
+	'rte_vhost.h' \
+	'rte_eth_vhost.h' \
 }
 : ${IGNORE_CXX= \
+	'rte_vhost.h' \
 	'rte_eth_vhost.h' \
-	'rte_virtio_net.h' \
 }
 
 temp_cc=/tmp/${0##*/}.$$.c
diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 7a586e4..605e47c 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -40,13 +40,19 @@
  */
 
 #include <stdint.h>
-#include <linux/vhost.h>
-#include <linux/virtio_ring.h>
 #include <sys/eventfd.h>
 
 #include <rte_memory.h>
 #include <rte_mempool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These are not C++-aware. */
+#include <linux/vhost.h>
+#include <linux/virtio_ring.h>
+
 #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
 #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY	(1ULL << 2)
@@ -70,7 +76,7 @@ struct rte_vhost_mem_region {
  */
 struct rte_vhost_memory {
 	uint32_t nregions;
-	struct rte_vhost_mem_region regions[0];
+	struct rte_vhost_mem_region regions[];
 };
 
 struct rte_vhost_vring {
@@ -426,4 +432,8 @@ int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem);
 int rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx,
 			      struct rte_vhost_vring *vring);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_VHOST_H_ */
-- 
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 [PATCH 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 02/13] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 04/13] net: fix missing include " Adrien Mazarguil
2017-04-24 15:52 ` [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 ` [PATCH 06/13] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 07/13] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-24 16:19   ` Legacy, Allain
2017-04-24 15:53 ` [PATCH 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-24 15:53 ` [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 ` [PATCH 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25  8:29 ` [PATCH v2 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-25  8:29   ` [PATCH v2 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-25 15:38     ` Zhang, Roy Fan
2017-04-25  8:29   ` [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   ` [PATCH v2 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-25  8:29   ` [PATCH v2 04/13] net: fix missing include " Adrien Mazarguil
2017-04-25 16:13     ` Singh, Jasvinder
2017-04-25  8:29   ` [PATCH v2 05/13] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25  8:30   ` [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   ` [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   ` [PATCH v2 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-25 11:35     ` [dpdk-stable] " Shahaf Shuler
2017-04-25  8:30   ` [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   ` [PATCH v2 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25 10:04   ` [PATCH v2 00/13] Fixes for exported headers Ferruh Yigit
2017-04-26 12:07   ` [PATCH v3 00/14] " Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 01/14] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-26 12:07     ` [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     ` [PATCH v3 03/14] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 04/14] net: fix missing include " Adrien Mazarguil
2017-04-26 12:07     ` Adrien Mazarguil [this message]
2017-04-26 12:07     ` [PATCH v3 06/14] mbuf: fix missing includes " Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 07/14] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 08/14] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` [PATCH v3 09/14] efd: fix missing include " Adrien Mazarguil
2017-04-26 15:36       ` De Lara Guarch, Pablo
2017-04-26 12:07     ` [PATCH v3 10/14] metrics: fix errors " Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` [PATCH v3 11/14] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 12/14] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-26 12:07     ` [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     ` [PATCH v3 14/14] eal: fix debug macro redefinition Adrien Mazarguil
2017-04-30 22:13     ` [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=f8efa0f4f078468447546d9622348e9f17baff3e.1493208189.git.adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.