Re: [PATCH] linux/container_of.h: switch to static_assert

From: Miguel Ojeda
Date: Fri Oct 15 2021 - 09:08:20 EST


On Fri, Oct 15, 2021 at 11:05 AM Rasmus Villemoes
<linux@xxxxxxxxxxxxxxxxxx> wrote:
>
> _Static_assert() is evaluated already in the compiler's frontend, and
> gives a somehat more to-the-point error, compared to the BUILD_BUG_ON
> macro, which only fires after the optimizer has had a chance to
> eliminate calls to functions marked with
> __attribute__((error)). In theory, this might make builds a tiny bit
> faster.

Thanks for this! Very much in favor!

Reviewed-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Perhaps Andrew may want to add a link to the related discussion
thread: https://lore.kernel.org/lkml/20211014132331.GA4811@xxxxxxxxxx/T/

Cheers,
Miguel