Quantcast
Channel: lkml.org : Ganesh Sittampalam
Viewing all articles
Browse latest Browse all 627

Re: [PATCH v3 1/6] ilog2: create truly constant version for sparse

$
0
0
Linus Torvalds writes: (Summary) Sometimes __builtin_constant_p() to a ternary operation acts as a constant expression, and sometimes it doesn't.
constant expression, and sometimes it doesn't.
Oh well.
Oh well.

[...]

sparse 0.5.2 doesn't warn about that either.
Yeah, sparse doesn't get picky about "constant value" vs "constant expression" normally. Because it would make us do that dynamic "__ilog2_uXX()" function call even when you have a compile-time constant value, if it wasn't actually a constant expression (ie a constant argument passed to an inline function, for example).
inline function, for example).
So I guess your patch is fine, but I also wonder if we should just default sparse to allow the good old non-strict "constant values are ok" for indexes.
ok" for indexes.
And turn on strict mode only with -pedantic or something.

Viewing all articles
Browse latest Browse all 627

Trending Articles