Re: [PATCH] compiler.h: Explain how __is_constexpr() works
From: Kees Cook
Date: Fri Mar 01 2024 - 20:47:05 EST
On Sat, Mar 02, 2024 at 03:17:32AM +0200, Andy Shevchenko wrote:
> Thu, Feb 29, 2024 at 08:44:37PM -0800, Kees Cook kirjoitti:
> > The __is_constexpr() macro is dark magic. Shed some light on it with
> > a comment to explain how and why it works.
>
> I was under impression that somebody did it already once and it fell through
> cracks when has been moved (?) to compiler.h.
I tried to do it before (see the v1).
>
> Ah, now I see it, https://lore.kernel.org/all/YKeghxRY4FeOKuwb@xxxxxxxxxxxxxxxxxx/.
> It was asked, but till now never fulfilled (maybe Reported-by:/Closes: tag?).
Sure! akpm was hardly the first to ask about it, but yeah, makes for
some good tags.
Reported-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20210520134112.ee15f156f1b7dbd3d8f16471@xxxxxxxxxxxxxxxxxxxx/
:)
> And explanation before was given here:
> https://stackoverflow.com/questions/49481217/linux-kernels-is-constexpr-macro.
Sure, but I wanted something that lived with the macro and everyone was
happy with the details.
-Kees
--
Kees Cook