Re: [PATCH v2 15/20] linux/compiler.h: Implement __must_be_array() in terms of __must_be()

From: Arnd Bergmann
Date: Sun Nov 21 2021 - 08:26:12 EST


On Sat, Nov 20, 2021 at 2:00 PM Alejandro Colomar
<alx.manpages@xxxxxxxxx> wrote:

> @@ -255,7 +255,7 @@ static inline void *offset_to_ptr(const int *off)
> #endif /* __ASSEMBLY__ */
>
> /* &a[0] degrades to a pointer: a different type from an array */
> -#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> +#define __must_be_array(a) __must_be(!__same_type((a), &(a)[0]))

Please go the other way here and change all users of __must_be() to use
BUILD_BUG_ON_ZERO() or BUILD_BUG_ON() for consistency.

Arnd