On Thu, 5 Dec 2024 at 18:26, David Laight <David.Laight@xxxxxxxxxx> wrote: > > From: Vincent Mailhol > > ACK. Would adding a suggested--by Linus tag solve your concern? I'm genberally the one person who doesn't need any more credit ;) > I actually suspect the first patches to change __is_constexpr() to > use _Generic were from myself. Yes. And David was also I think the one who suggested something else than "!!" originally too. I may have liked "!!" for being very idiomatic and traditional C, but there were those pesky compilers that warn about "integer in bool context" or whatever the annoying warning was when then doing the "multiply by zero" to turn a constant expression into a constant zero expression. So that #define is_const(x) __is_const_zero(0 * (x)) causes issues when 'x' is not an integer expression (think "is_const(NULL)" or "is_const(1 == 2)". Side note: I think "(x) == 0" will make sparse unhappy when 'x' is a pointer, because it results that horrid "use integer zero as NULL without a cast" thing when the plain zero gets implicitly cast to a pointer. Which is a really nasty and broken C pattern and should never have been silent. I think David suggested using ((x)?0:0) at some point. Silly nonsensical and complex expression, but maybe that finally gets rid of all the warnings: #define is_const(x) __is_const_zero((x)?0:0) might work regardless of the type of 'x'. Or does that trigger some odd case too? Linus