lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db4143302c0847aabb15a621b60a59c0@AcuMS.aculab.com>
Date: Thu, 25 Jul 2024 08:45:07 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Linus Torvalds' <torvalds@...uxfoundation.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Matthew
 Wilcox (Oracle)" <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>, Arnd Bergmann <arnd@...nel.org>,
	"Jason@...c4.com" <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: Linus Torvalds
> Sent: 24 July 2024 20:49
> 
> On Wed, 24 Jul 2024 at 07:30, David Laight <David.Laight@...lab.com> wrote:
> >
> > Implemented using _Generic() for portibility.
> 
> I do think this is ultimately the clearer implementation, if only
> because the underlying trick it uses does very much depend on a very
> special oddity in the C type system.
> 
> So then using the type comparison with _Generic() is rather natural,
> and allows for picking other things than 0/1 as a result.
> 
> However, there is NO WAY this is a "portability" enhancement.

The old code relied on sizeof(void) which is invalid C.

So this version can be used when that gcc extension isn't enabled.
While the linux kernel rather assumes it other builds (eg nolibc) don't.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ