[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d6217d937994620a5de0d8967f518c0@AcuMS.aculab.com>
Date: Thu, 25 Jul 2024 09:12:57 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Arnd Bergmann' <arnd@...nel.org>, "'linux-kernel@...r.kernel.org'"
<linux-kernel@...r.kernel.org>, Linus Torvalds <torvalds@...uxfoundation.org>
CC: Matthew Wilcox <willy@...radead.org>, Christoph Hellwig
<hch@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>, "Andy
Shevchenko" <andriy.shevchenko@...ux.intel.com>, Dan Carpenter
<dan.carpenter@...aro.org>, "Jason A . Donenfeld" <Jason@...c4.com>,
"'pedro.falcato@...il.com'" <pedro.falcato@...il.com>, Mateusz Guzik
<mjguzik@...il.com>, "'linux-mm@...ck.org'" <linux-mm@...ck.org>
Subject: RE: [PATCH 3/7] compiler.h: Add __if_constexpr(expr, if_const,
if_not_const)
From: Arnd Bergmann
> Sent: 24 July 2024 18:32
>
> On Wed, Jul 24, 2024, at 16:29, David Laight wrote:
>
> > +#define __if_constexpr(expr, if_const, if_not_const) \
> > + _Generic(0 ? ((void *)((long)(expr) * 0l)) : (char *)0, \
> > + char *: (if_const), \
> > + void *: (if_not_const))
> > +
> > -#define __is_constexpr(x) \
> > - (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
> > +#define __is_constexpr(expr) __if_constexpr((expr), 1, 0)
>
> I don't immediately see anything wrong with this, but I'm
> still scared of any change to it, especially if this is
> meant to go straight into mainline.
Well it would be -rc1 (or maybe -rc2).
> Would it be possible to do patch 4/7 without the new
> __if_constexpr() and instead still using __builtin_choose_expr()?
The safer option would be to add __if_constexpr() but leave the
change to __is_constexpr() for 'next'.
David
>
> Arnd
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists