mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 02:21:39 -04:00
selftests: harness: Mark test fixture objects __maybe_unused
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 commitff556bd983("vfio: selftests: Add -Wall and -Werror to the Makefile"), and the net selftests builds have been noisy due to -Wall. Fixes:24cf65a622("selftests/harness: Share _metadata between forked processes") Reported-by: Kuniyuki Iwashima <kuniyu@google.com> Reported-by: Aaron Lewis <aaronlewis@google.com> Reviewed-by: Alex Williamson <alex@shazbot.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20260706183154.2660394-1-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
This commit is contained in:
committed by
Alex Williamson
parent
28ca5f67e1
commit
37ffa24c9d
@@ -467,7 +467,7 @@ static inline void __kselftest_memset_safe(void *s, int c, size_t n)
|
||||
!__atomic_test_and_set(_metadata->no_teardown, __ATOMIC_RELAXED)) \
|
||||
fixture_name##_teardown(_metadata, self, variant); \
|
||||
} \
|
||||
static struct __test_metadata *_##fixture_name##_##test_name##_object; \
|
||||
static struct __test_metadata *_##fixture_name##_##test_name##_object __maybe_unused; \
|
||||
static void __attribute__((constructor(KSELFTEST_PRIO_TEST))) \
|
||||
_register_##fixture_name##_##test_name(void) \
|
||||
{ \
|
||||
|
||||
Reference in New Issue
Block a user