Re: [PATCH v3] selftests: harness: Mark test fixture objects __maybe_unused

From: Alex Williamson

Date: Wed Aug 12 2026 - 16:53:56 EST


On Tue, 11 Aug 2026 13:21:37 -0700
David Matlack <dmatlack@xxxxxxxxxx> wrote:

> On Wed, Jul 15, 2026 at 9:03 AM Kees Cook <kees@xxxxxxxxxx> wrote:
> >
> > On Tue, Jul 14, 2026 at 09:24:36AM -0700, David Matlack wrote:
> > > On Mon, Jul 6, 2026 at 11:32 AM David Matlack <dmatlack@xxxxxxxxxx> wrote:
> > > >
> > > > Mark _##fixture_name##_##test_name##_object __maybe_unused since it may
> > > > not ever be read. This pointer is only read in XFAIL_ADD(), which tests
> > > > are not required to use.
> > > >
> > > > clang made a change to -Wunused-but-set-variable (split out into its own
> > > > subwarning, -Wunused-but-set-global) that causes this warning to be
> > > > emitted for various selftests and can be upgraded to an error in
> > > > selftest that set -Werror.
> > > >
> > > > VFIO selftests have been broken since commit ff556bd98348 ("vfio:
> > > > selftests: Add -Wall and -Werror to the Makefile"), and the net
> > > > selftests builds have been noisy due to -Wall.
> > > >
> > > > Fixes: 24cf65a62266 ("selftests/harness: Share _metadata between forked processes")
> > > > Reported-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
> > > > Reported-by: Aaron Lewis <aaronlewis@xxxxxxxxxx>
> > > > Reviewed-by: Alex Williamson <alex@xxxxxxxxxxx>
> > > > Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
> > > > Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
> > >
> > > Kees and Shuah, is it ok if Alex takes this through the VFIO tree? [1]
> > > This fixes a bug exposed by recent VFIO selftests commit ff556bd98348
> > > ("vfio: selftests: Add -Wall and -Werror to the Makefile").
> > >
> > > [1] https://lore.kernel.org/linux-kselftest/20260630165244.0d013bbc@xxxxxxxxxxx/
> >
> > Yeah, please do. This has ample review. :)
>
> Thanks. Alex, can you pick this one up for 7.2 if there's still time,
> or for 7.3 otherwise?

Thanks for the reminder, applied to vfio next branch for v7.3. Thanks,

Alex