Subject: Re: [PATCH 05/11] selftests: Add additional kernel functions to tools/include/

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 14 May 2026 16:03:53 -0300

On Mon, May 04, 2026 at 09:48:43PM +0000, David Matlack wrote:
> On 2026-04-30 09:08 PM, Jason Gunthorpe wrote:
> > These are needed by the VFIO mlx5 selftest in the following patches,
> > which includes some headers from mlx5 and also needs a few more
> > MMIO-related features.
> > 
> > - DECLARE_FLEX_ARRAY in new tools/include/linux/stddef.h (wraps
> >   existing __DECLARE_FLEX_ARRAY from uapi/linux/stddef.h)
> 
> Is this needed? I don't see it used anywhere.
> 
>   $ git grep DECLARE_FLEX_ARRAY tools/testing/selftests/vfio

Turns out it is needed implicitly in existing headers:

In file included from /home/jgg/oss/wip/mlx5st/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5_hw.h:16:
/home/jgg/oss/wip/mlx5st/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5_ifc.h:4352:3: error: type name requires a
      specifier or qualifier
 4352 |                 DECLARE_FLEX_ARRAY(struct mlx5_ifc_rq_num_bits, rq_num);
      |                 ^
/home/jgg/oss/wip/mlx5st/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5_ifc.h:4352:51: error: type specifier missing,
      defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
 4352 |                 DECLARE_FLEX_ARRAY(struct mlx5_ifc_rq_num_bits, rq_num);

Jason