Re: [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ()

From: Paul Walmsley

Date: Fri Mar 20 2026 - 20:24:35 EST


On Mon, 9 Mar 2026, Charlie Jenkins via B4 Relay wrote:

> From: Charlie Jenkins <thecharlesjenkins@xxxxxxxxx>
>
> EXPECT_EQ() expands to multiple lines, breaking up one-line if
> statements. This issue was not present in the patch on the mailing list
> but was instead introduced by the maintainer when attempting to fix up
> checkpatch warnings. Add braces around EXPECT_EQ() to avoid the error
> even though checkpatch suggests them to be removed:
>
> validate_v_ptrace.c:626:17: error: ‘else’ without a previous ‘if’

That's annoying. Can't the macro body be wrapped in do { ... } while (0);
instead, rather than adding these permanent checkpatch warnings?


- Paul