From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id BCA8F5A44 for ; Tue, 25 Apr 2017 10:30:24 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id m123so88856047wma.0 for ; Tue, 25 Apr 2017 01:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=a9YOlEpEEbbsuQHhahaPbXbJ8d1gDQKr+pdsUzJX3a0=; b=FHdmIwnNOWKYMf35FWKsWWbHhdtiNPXvG3oS4/psQlc9lTdOlqhLk613Y4ICkd5Wv1 rx2XbQ0cVpQdsxiWzWiNCLJ14d7g2gVR4Zmu2JqEzDi92vs52oGAFsr1MYbD3BjIJJ0i vKi/YKvIfxW/EK3tG7vQFZ6tVGmmVCpbFNOW4Gpbeq/GGR9udDHIctlb+cXdBRpaTtAf vflzQy92wnh7kbRmXdVW4rzvcyCGqCUJVctvwTgkXwTXIETf/nQtDb2dv4ZZcGkzj+Z7 jNcDF1WwPsrkC57kltMaoO29oz9AdFuq8m4BU2++331dehhAbq4lK1dzQa5wV9w5dm7l ewIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=a9YOlEpEEbbsuQHhahaPbXbJ8d1gDQKr+pdsUzJX3a0=; b=oPAOojypxXH3hDuPRn/jtsydPN4LpONExy8zjZwTB2153oWYPa3bKbLhHHYWT+Jz2A NaJn6WqlfRCaLQCV7GmWPXGDG8sC2DSlieCuvwpEOca/qgLy4Zj+tAWl/jDMqgio9nsR /l0Dl2GBrkDJduF7Tb//V95vxqhiZtdhUXLU+BMLsxXDWxmHE9zy+rDQB1QlEFiwPuyi rh2ip/FalwbxEIsWNwU5PUfvmTU7kuyFmat48fn2iXIG5VemVUKJADgo3vRaG/iHz0dV mdr72k3Vi+G+AlpkucHMKEyquBDZ+ZKoQOkrxa33tEyxpxb8IQgkmjf9RgUhst788rmk KRWg== X-Gm-Message-State: AN3rC/7A3sfyIZ3TFLBK66vJkQVo2bM6yg2BDbHUSF31I1DeYQVnCuzj UlAvpdipj6mUq2qiEsc= X-Received: by 10.28.136.8 with SMTP id k8mr1061492wmd.1.1493109024208; Tue, 25 Apr 2017 01:30:24 -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 g90sm8199537wrd.11.2017.04.25.01.30.23 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 25 Apr 2017 01:30:23 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 25 Apr 2017 10:29:59 +0200 Message-Id: <7b0eb0da0edd5ac747d8876e3e28869479a06ace.1493108423.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 05/13] vhost: fix errors with strict compilation flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 08:30:25 -0000 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 Acked-by: Yuanhan Liu --- 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 -#include -#include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + +/* These are not C++-aware. */ +#include +#include + #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