[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <24be8665-4717-4ee2-8a81-80fed5181736@app.fastmail.com>
Date: Wed, 24 Jul 2024 19:32:14 +0200
From: "Arnd Bergmann" <arnd@...nel.org>
To: "David Laight" <David.Laight@...lab.com>,
"'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)
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.
Would it be possible to do patch 4/7 without the new
__if_constexpr() and instead still using __builtin_choose_expr()?
Arnd
Powered by blists - more mailing lists