[PATCH v5 07/10] net/mlx5: replace zero length array with flex array
Dariusz Sosnowski
dsosnowski at nvidia.com
Tue Jan 23 12:18:55 CET 2024
From: Thomas Monjalon <thomas at monjalon.net>
Sent: Tuesday, January 23, 2024 11:28
> 23/01/2024 10:44, Thomas Monjalon:
> > 29/11/2023 03:39, Stephen Hemminger:
> > > --- a/drivers/net/mlx5/mlx5_tx.h
> > > +++ b/drivers/net/mlx5/mlx5_tx.h
> > > @@ -171,11 +171,12 @@ struct mlx5_txq_data {
> > > struct mlx5_txq_stats stats; /* TX queue counters. */
> > > struct mlx5_txq_stats stats_reset; /* stats on last reset. */
> > > struct mlx5_uar_data uar_data;
> > > - struct rte_mbuf *elts[0];
> > > + struct rte_mbuf *elts[];
> > > /* Storage for queued packets, must be the last field. */ }
> > > __rte_cache_aligned;
> > >
> > > /* TX queue control descriptor. */
> > > +__extension__
> > > struct mlx5_txq_ctrl {
> >
> > struct mlx5_txq_data is included at the end of struct mlx5_txq_ctrl I
> > don't understand why we need to declare an extension here.
>
> If I remove __extension__:
> error: invalid use of structure with flexible array member [-Werror=pedantic]
>
> Is it a problem only in pedantic mode?
Yes, because this usage is nonstandard. Using a struct which has a flexible array member, inside another struct is a compiler extension.
Best regards,
Dariusz Sosnowski
More information about the dev
mailing list