[PATCH 4/7] mlx5: replace zero length array with flex array
Slava Ovsiienko
viacheslavo at nvidia.com
Mon Mar 6 14:29:35 CET 2023
Hi, Stephen
IIUC - for now all of the compilers claimed for DPDK compilation support the zero-length-array and we do not have an issue ?
We could eliminate this GNU extension and have workaround, like this:
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include <infiniband/mlx5dv.h>
#include <infiniband/verbs.h>
#ifdef PEDANTIC
#pragma GCC diagnostic error "-Wpedantic"
#endif
I'm not sure this would make code more readable.
Should we do this WA?
With best regards,
Slava
> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: суббота, 14 января 2023 г. 19:08
> To: dev at dpdk.org
> Cc: Matan Azrad <matan at nvidia.com>; Slava Ovsiienko
> <viacheslavo at nvidia.com>
> Subject: Re: [PATCH 4/7] mlx5: replace zero length array with flex array
>
> On Fri, 13 Jan 2023 13:52:02 -0800
> Stephen Hemminger <stephen at networkplumber.org> wrote:
>
> > Zero length arrays are GNU extension. Replace with standard flex
> > array.
> >
> > Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> > ---
>
>
> Since Mlx driver enables pedantic checking, this causes build failure on some
> versions of gcc.
>
> In file included from ../drivers/net/mlx5/mlx5.c:40:
> ../drivers/net/mlx5/mlx5_tx.h:187:23: error: invalid use of structure with
> flexible array member [-Werror=pedantic]
> 187 | struct mlx5_txq_data txq; /* Data path structure. */
> | ^~~
>
>
> Understand that the driver wants to enable more checking since Nvidia does
> good job of keeping the code up to date. But having driver specific compiler
> flags like this creates more unnecessary complexity and doesn't improve the
> resulting code.
More information about the dev
mailing list