[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjLSEcZ5LdW+3C+9rtjvNPHZT6zdk0POj67T5k2ZpDbgA@mail.gmail.com>
Date: Thu, 14 Nov 2024 10:28:02 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Philipp Reisner <philipp.reisner@...bit.com>, Kees Cook <keescook@...omium.org>
Cc: Luc Van Oostenryck <luc.vanoostenryck@...il.com>, linux-sparse@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] compiler.h: Add missing include statement for build_bug.h
On Thu, 14 Nov 2024 at 09:42, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> I think a better fix would be to not use BUILD_BUG_ON_ZERO() at all,
> but just use _Static_assert() directly here, to make
> <linux/compiler.h> be more self-sufficient.
Damn. We can't do that, because we typically use this in contexts that
require us to return zero (because the assertion part of an
expression), and then that whole expression needs to be a constant
integer expression.
And because _Static_assert() isn't an expression, we'd need to wrap it
with a statement expression or something.
And *hat* we can't do in arbitrary contexts.
Grr. I absolutely detest how bad the standard tools are. It's kind of
sad how we need to build our own hacky BUILD_BUG_ON() to do this.
There's probably some trick I'm missing, but yeah, it looks like we
need our BUILD_BUG_ON_ZERO() thing with that crazy bitfield hack.
Linus
Powered by blists - more mailing lists