Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 12:28 -0800 schrieb Linus Torvalds: > On Sat, 7 Dec 2024 at 11:19, Martin Uecker wrote: > > > > But that all seem solvable issues on the compiler side. > [... Itanium, value range analysis, no assertions in kernel...] > Now, would we want to have proper value *sta

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Linus Torvalds
On Sat, 7 Dec 2024 at 05:07, Martin Uecker wrote: > > VLA use *less* stack than a fixed size arrays with fixed bound. Not really. You end up with tons of problems, not the least of which is how to actually analyze the stack size. It also gets *very* nasty to have code that declares the VLA size u

Re: [PATCH 01/10] compiler.h: add statically_false()

2024-12-07 Thread Vincent Mailhol
On Fri. 6 Dec. 2024 at 12:39, David Laight wrote: > From: Vincent Mailhol > > Sent: 05 December 2024 15:26 > > > > On Thu. 5 Dec 2024 at 03:30, David Laight wrote: > > > From: Vincent Mailhol > > > > Sent: 02 December 2024 17:33 > > > > > > > > From: Vincent Mailhol > > > > > > > > For completio

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Vincent Mailhol > Sent: 07 December 2024 13:51 ... > > > It seems to me that the long term solution to this problem are the > > > constexpr functions. > > > > How would constexpr functions help here? (I am a bit sceptical about > > constexpr functions.) > > I was thinking of some of the "si

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Linus Torvalds
On Sat, 7 Dec 2024 at 11:19, Martin Uecker wrote: > > But that all seem solvable issues on the compiler side. You know, there was a whole *architecture* that was designed and predicated on "it's all solvable on the compiler side". That architecture was pure and utter *shit*. Because no, it's no

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Linus Torvalds
On Sat, 7 Dec 2024 at 11:51, Martin Uecker wrote: > > Am Samstag, dem 07.12.2024 um 10:19 -0800 schrieb Linus Torvalds: > > > > If there is one feature of C I would have liked it is "allow inline > > functions and statement expressions with constant arguments as > > constant expressions". > > Ther

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Linus Torvalds
On Sat, 7 Dec 2024 at 15:52, Martin Uecker wrote: > > Can you point me to some horror stories? So the main issues tended to be about various static verification tools. Ranging from things like the stackleak plugin for gcc, where handling VLA's and alloca() (which are pretty much the same thing w

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Vincent Mailhol
On Sun. 8 Dec. 2024 at 00:10, Martin Uecker wrote: > Am Samstag, dem 07.12.2024 um 22:50 +0900 schrieb Vincent Mailhol: > > On Sat. 7 Dec. 2024 à 22:19, Martin Uecker wrote: > > > > ... > > > > > I was invited to WG14 this September. For now, I am only lurking. The > > thing I have in mind right

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 10:19 -0800 schrieb Linus Torvalds: > On Sat, 7 Dec 2024 at 04:24, Vincent Mailhol > wrote: > > > > > No good - expands everything twice. > > > > And? __is_const_zero() does not evaluate its arguments, so no side effect: > > No, the problem is literally the expans

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Linus Torvalds > Sent: 07 December 2024 20:31 ... > We're currently still accepting gcc-5.1 as a compiler, although it's > time to look at that and probably (judging by what stable distros use) > upgrade to something like gcc-8.1 as the minimum supported compiler > version. That's going to a

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Martin Uecker > Sent: 07 December 2024 19:52 ... > > Of course, often the compiler *does* have helper builtins, but we > > can't use them, because they aren't *quite* the right thing. Like that > > "__builtin_constant_p()" not actually working for some situations > > where we absolutely need

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 21:00 + schrieb David Laight: > From: Martin Uecker > > Sent: 07 December 2024 19:52 ... > > > There exist proposals along those lines for C2Y. > > > > From a more near-term solution, I wonder if making it possible (or > > easier) to return integer constant expr

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 22:50 +0900 schrieb Vincent Mailhol: > On Sat. 7 Dec. 2024 à 22:19, Martin Uecker wrote: > > ... > > I was invited to WG14 this September. For now, I am only lurking. The > thing I have in mind right now is to write a paper to allow the use of > static_assert() in

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 22:50 +0900 schrieb Vincent Mailhol: > On Sat. 7 Dec. 2024 à 22:19, Martin Uecker wrote: > > Am Samstag, dem 07.12.2024 um 21:45 +0900 schrieb Vincent Mailhol: > > > On Sat. 7 Dec. 2024 at 17:39, Martin Uecker wrote: > > > > Am Freitag, dem 06.12.2024 um 16:26 +0900

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Linus Torvalds
On Sat, 7 Dec 2024 at 04:24, Vincent Mailhol wrote: > > > No good - expands everything twice. > > And? __is_const_zero() does not evaluate its arguments, so no side effect: No, the problem is literally the expansion. Double expansion of these fundamental helpers gets exponential, because they ar

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Martin Uecker > Sent: 07 December 2024 21:06 > > Am Samstag, dem 07.12.2024 um 21:00 + schrieb David Laight: > > From: Martin Uecker > > > Sent: 07 December 2024 19:52 > ... > > > > > > There exist proposals along those lines for C2Y. > > > > > > From a more near-term solution, I wonder

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 10:26 -0800 schrieb Linus Torvalds: > On Sat, 7 Dec 2024 at 05:07, Martin Uecker wrote: > > > > VLA use *less* stack than a fixed size arrays with fixed bound. > > Not really. You end up with tons of problems, not the least of which > is how to actually analyze the

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Martin Uecker > Sent: 07 December 2024 08:40 ... > I find it amazing how much time the Linux kernel community spends > revising code to make it work perfectly. > > Still, I am wondering whether some of this time and effort should not > be targeted at C compilers and language work to make the

RE: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread David Laight
From: Vincent Mailhol > Sent: 07 December 2024 07:43 ... > > So maybe the slightly long lines: > > #define const_true(x) _Generic(0 ? (void *)((x) + 0 ? 0L : 1L) : (char *)0, > > char *: 1, void *: 0) > > #define const_expr(x) _Generic(0 ? (void *)((x) + 0 ? 0L : 0L) : (char *)0, > > char *: 1, v

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Freitag, dem 06.12.2024 um 16:26 +0900 schrieb Vincent Mailhol: > > On Fri. 6 Dec. 2024 at 15:40, Martin Uecker wrote: > > > > Am Freitag, dem 06.12.2024 um 02:25 + schrieb David Laight: > > > > > > From: Vincent Mailhol > > > > > > > > Sent: 05 December 2024 15:31 > > > > > > > > > > > >

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Vincent Mailhol
On Fri. 6 Dec. 2024 at 16:19, Vincent Mailhol wrote: > On Fri. 6 Dec. 2024 at 15:14, Linus Torvalds > wrote: > > On Thu, 5 Dec 2024 at 18:26, David Laight wrote: (...) > > I may have liked "!!" for being very idiomatic and traditional C, but > > there were those pesky compilers that warn about

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Vincent Mailhol
On Sat. 7 Dec. 2024 at 20:19, David Laight wrote: > From: Vincent Mailhol > > Sent: 07 December 2024 07:43 > ... > > > So maybe the slightly long lines: > > > #define const_true(x) _Generic(0 ? (void *)((x) + 0 ? 0L : 1L) : (char > > > *)0, char *: 1, void *: 0) > > > #define const_expr(x) _Gener

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Vincent Mailhol
On Sat. 7 Dec. 2024 at 17:39, Martin Uecker wrote: > Am Freitag, dem 06.12.2024 um 16:26 +0900 schrieb Vincent Mailhol: > > > On Fri. 6 Dec. 2024 at 15:40, Martin Uecker wrote: > > > > > Am Freitag, dem 06.12.2024 um 02:25 + schrieb David Laight: > > > > > > > From: Vincent Mailhol > > > > >

RE: [PATCHv2 01/10] drm/crtc: Add histogram properties

2024-12-07 Thread Dmitry Baryshkov
On 6 December 2024 12:33:38 EET, "Murthy, Arun R" wrote: >> On Thu, Dec 05, 2024 at 04:29:55PM +, Murthy, Arun R wrote: >> > > > > -Original Message- >> > > > > From: Dmitry Baryshkov >> > > > > Sent: Wednesday, December 4, 2024 5:17 PM >> > > > > To: Murthy, Arun R >> > > > > Cc: i

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 21:45 +0900 schrieb Vincent Mailhol: > On Sat. 7 Dec. 2024 at 17:39, Martin Uecker wrote: > > Am Freitag, dem 06.12.2024 um 16:26 +0900 schrieb Vincent Mailhol: ... > > I find it amazing how much time the Linux kernel community spends > > revising code to make it wo

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Martin Uecker
Am Samstag, dem 07.12.2024 um 10:33 + schrieb David Laight: > From: Martin Uecker > > Sent: 07 December 2024 08:40 > ... > > I find it amazing how much time the Linux kernel community spends > > revising code to make it work perfectly. > > > > Still, I am wondering whether some of this time an

Re: [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr()

2024-12-07 Thread Vincent Mailhol
On Sat. 7 Dec. 2024 à 22:19, Martin Uecker wrote: > Am Samstag, dem 07.12.2024 um 21:45 +0900 schrieb Vincent Mailhol: > > On Sat. 7 Dec. 2024 at 17:39, Martin Uecker wrote: > > > Am Freitag, dem 06.12.2024 um 16:26 +0900 schrieb Vincent Mailhol: > > ... > > > > I find it amazing how much time th