vhost: fix build with gcc 4.8

Message ID 20230703082153.504569-1-alialnu@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: fix build with gcc 4.8 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Ali Alnubani July 3, 2023, 8:21 a.m. UTC
  Adds braces around initializer to resolve the following
false-positive build error with gcc 4.8.5 on CentOS:
lib/vhost/vduse.c:441:9: error: missing braces around initializer
  [-Werror=missing-braces]

Fixes: 653327e191f0 ("vhost: add multiqueue support to VDUSE")
Cc: maxime.coquelin@redhat.com

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---
 lib/vhost/vduse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin July 3, 2023, 8:29 a.m. UTC | #1
Hi Ali,

On 7/3/23 10:21, Ali Alnubani wrote:
> Adds braces around initializer to resolve the following
> false-positive build error with gcc 4.8.5 on CentOS:
> lib/vhost/vduse.c:441:9: error: missing braces around initializer
>    [-Werror=missing-braces]
> 
> Fixes: 653327e191f0 ("vhost: add multiqueue support to VDUSE")
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> ---
>   lib/vhost/vduse.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
> index a509daf80c..aa5f1f564d 100644
> --- a/lib/vhost/vduse.c
> +++ b/lib/vhost/vduse.c
> @@ -438,7 +438,7 @@ vduse_device_create(const char *path)
>   	pthread_t fdset_tid;
>   	uint32_t i, max_queue_pairs, total_queues;
>   	struct virtio_net *dev;
> -	struct virtio_net_config vnet_config = { 0 };
> +	struct virtio_net_config vnet_config = {{ 0 }};
>   	uint64_t ver = VHOST_VDUSE_API_VERSION;
>   	uint64_t features = VDUSE_NET_SUPPORTED_FEATURES;
>   	struct vduse_dev_config *dev_config = NULL;

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

This is not going to introduce any functional change so this is fine,
but the DPDK documentation indicates the minimum requirement is GCC 4.9[0]:

"
General development tools including a supported C compiler such as gcc 
(version 4.9+) or clang (version 3.4+), and pkg-config or pkgconf to be 
used when building end-user binaries against DPDK.
"

Thanks,
Maxime

[0]: 
http://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdk
  
Maxime Coquelin July 6, 2023, 9:05 a.m. UTC | #2
On 7/3/23 10:21, Ali Alnubani wrote:
> Adds braces around initializer to resolve the following
> false-positive build error with gcc 4.8.5 on CentOS:
> lib/vhost/vduse.c:441:9: error: missing braces around initializer
>    [-Werror=missing-braces]
> 
> Fixes: 653327e191f0 ("vhost: add multiqueue support to VDUSE")
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> ---
>   lib/vhost/vduse.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
> index a509daf80c..aa5f1f564d 100644
> --- a/lib/vhost/vduse.c
> +++ b/lib/vhost/vduse.c
> @@ -438,7 +438,7 @@ vduse_device_create(const char *path)
>   	pthread_t fdset_tid;
>   	uint32_t i, max_queue_pairs, total_queues;
>   	struct virtio_net *dev;
> -	struct virtio_net_config vnet_config = { 0 };
> +	struct virtio_net_config vnet_config = {{ 0 }};
>   	uint64_t ver = VHOST_VDUSE_API_VERSION;
>   	uint64_t features = VDUSE_NET_SUPPORTED_FEATURES;
>   	struct vduse_dev_config *dev_config = NULL;


Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index a509daf80c..aa5f1f564d 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -438,7 +438,7 @@  vduse_device_create(const char *path)
 	pthread_t fdset_tid;
 	uint32_t i, max_queue_pairs, total_queues;
 	struct virtio_net *dev;
-	struct virtio_net_config vnet_config = { 0 };
+	struct virtio_net_config vnet_config = {{ 0 }};
 	uint64_t ver = VHOST_VDUSE_API_VERSION;
 	uint64_t features = VDUSE_NET_SUPPORTED_FEATURES;
 	struct vduse_dev_config *dev_config = NULL;