[PATCH v2 2/4] drivers: replace zero-length arrays with undimensioned ones
Bruce Richardson
bruce.richardson at intel.com
Fri Jun 3 11:18:26 CEST 2022
On Fri, Jun 03, 2022 at 09:19:35AM +0200, David Marchand wrote:
> Hello Bruce,
>
> On Thu, Jun 2, 2022 at 6:14 PM Bruce Richardson
> <bruce.richardson at intel.com> wrote:
> > diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
> > index bc3e70a1d1..ed0781a560 100644
> > --- a/drivers/common/mlx5/mlx5_prm.h
> > +++ b/drivers/common/mlx5/mlx5_prm.h
> > @@ -560,7 +560,7 @@ struct mlx5_umr_wqe {
> > struct mlx5_rdma_write_wqe {
> > struct mlx5_wqe_cseg ctr;
> > struct mlx5_wqe_rseg rseg;
> > - struct mlx5_wqe_dseg dseg[0];
> > + struct mlx5_wqe_dseg dseg[];
> > } __rte_packed;
> >
> > #ifdef PEDANTIC
> > @@ -3479,7 +3479,7 @@ struct mlx5_ifc_qpc_pas_list_bits {
> > #endif
> > struct mlx5_ifc_qpc_extension_and_pas_list_bits {
> > struct mlx5_ifc_qpc_extension_bits qpc_data_extension;
> > - u8 pas[0][0x40];
> > + u8[0x40] pas[];
>
> Gcc and clang seem to agree they disagree with coccinelle.
> clang suggests using u8 pas[][0x40].
>
Changing this as suggested gives further errors in builds (now that I have
the correct dependencies for the mlx5 driver installed on my system!)
In file included from ../../drivers/net/mlx5/mlx5_tx_empw.c:6:
../../drivers/net/mlx5/mlx5_tx.h:187:30: error: invalid use of structure with flexible array member [-Werror=pedantic]
187 | struct mlx5_txq_data txq; /* Data path structure. */
| ^~~
cc1: all warnings being treated as errors
Therefore, I'll just drop the cleanup of these structures from V3.
/Bruce
More information about the dev
mailing list