Re: [PATCH] compiler.h: Fix undefined BUILD_BUG_ON_ZERO()

From: Linus Torvalds
Date: Fri Nov 15 2024 - 17:15:00 EST


On Fri, 15 Nov 2024 at 12:46, Philipp Reisner
<philipp.reisner@xxxxxxxxxx> wrote:
>
> Fix that by defining __BUILD_BUG_ON_ZERO_MSG() in <linux/compiler.h>
> and using that for __must_be_array() and __must_be_cstr().

Ack, that cast to 'int' seems good too, to make sure the
__BUILD_BUG_ON_ZERO_MSG() test doesn't unintentionally change the type
of the expression it is in.

I do wonder if we actually need that "#ifdef __CHECKER__"? I think
sparse is perfectly fine with a _Static_assert(). Or does the checking
cause some other issues?

Linus