tools/testing/selftests/futex/functional/futex_requeue_pi.c | 1 + 1 file changed, 1 insertion(+)
The `FIXTURE(args)` macro defines an empty `struct _test_data_args`,
leading to `sizeof(struct _test_data_args)` evaluating to 0. This
caused a build error due to a compiler warning on a `memset` call
with a zero size argument.
Adding a dummy member to the struct ensures its size is non-zero,
resolving the build issue.
Signed-off-by: Wake Liu <wakel@google.com>
---
tools/testing/selftests/futex/functional/futex_requeue_pi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi.c b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
index f299d75848cd..000fec468835 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue_pi.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
@@ -52,6 +52,7 @@ struct thread_arg {
FIXTURE(args)
{
+ char dummy;
};
FIXTURE_SETUP(args)
--
2.52.0.rc1.455.g30608eb744-goog
On Wed, Nov 19 2025 at 11:00, Wake Liu wrote:
> The `FIXTURE(args)` macro defines an empty `struct _test_data_args`,
> leading to `sizeof(struct _test_data_args)` evaluating to 0. This
> caused a build error due to a compiler warning on a `memset` call
> with a zero size argument.
Where is that memset? The only possibly related one I can find in the
kselftest harness is:
if (sizeof(foo) > 0)
memset(foo, 0, sizeof(foo));
If your compiler complains about that, then you need to fix your
compiler and not perfectly correct code.
You again fail to provide enough information to understand what you are
trying to "fix" including the compiler version and related built
options.
Thanks,
tglx
Hi Wake, Em 19/11/2025 00:00, Wake Liu escreveu: > The `FIXTURE(args)` macro defines an empty `struct _test_data_args`, > leading to `sizeof(struct _test_data_args)` evaluating to 0. This > caused a build error due to a compiler warning on a `memset` call > with a zero size argument. > Do you mind sharing your compiler options? I can't reproduce this warning here. I also noted that a few other selftests have this pattern of defining an empty FIXTURE(), do they also produce warnings?
© 2016 - 2025 Red Hat, Inc.