Re: [PATCH 3/7] compiler.h: Add __if_constexpr(expr, if_const, if_not_const)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux