Gcc toolchain generates the warning as shown below. Fix them by adding necessary guarding.
clone.c: In function ‘run_clone3’: freestanding.h:82:9: warning: macro expands to multiple statements [-Wmultistatement-macros] 82 | do { \ | ^~ freestanding.h:97:31: note: in expansion of macro ‘__EXPECT’ 97 | #define ASSERT(exp, seen, op) __EXPECT(exp, seen, op, 1) | ^~~~~~~~ freestanding.h:100:30: note: in expansion of macro ‘ASSERT’ 100 | #define ASSERT_EQ(exp, seen) ASSERT(exp, seen, ==) | ^~~~~~ clone.c:484:17: note: in expansion of macro ‘ASSERT_EQ’ 484 | ASSERT_EQ(child_tid, 0); | ^~~~~~~~~ clone.c:483:9: note: some parts of macro expansion are not guarded by this ‘if’ clause 483 | if (args->flags & CLONE_CHILD_CLEARTID) | ^~
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com --- tools/testing/selftests/arm64/morello/clone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/morello/clone.c b/tools/testing/selftests/arm64/morello/clone.c index ca06adbf0dd9..69189287144a 100644 --- a/tools/testing/selftests/arm64/morello/clone.c +++ b/tools/testing/selftests/arm64/morello/clone.c @@ -456,8 +456,9 @@ void run_clone3(struct clone3_fixture *data) ASSERT_NE(parent_tid, 0); }
- if (args->flags & CLONE_CHILD_CLEARTID) + if (args->flags & CLONE_CHILD_CLEARTID) { ASSERT_EQ(child_tid, 0); + }
munmap((void *)args->stack, STACK_SIZE); if (args->flags & CLONE_SETTLS)