On Fri, Feb 7, 2020 at 12:13 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > In addition to this patch I've tried: > +#define __const_ilog2(n, unique_n) ({ \ > + typeof(n) unique_n = (n); \ Yeah, as you found out, this doesn't work for the case of having global initializers or things like array sizes. Which people do do - often nor directly, but through various size macros. It's annoying, but one of the failures of C is having a nice form of compile-time constant handling where you can do slightly smarter arithmetic. The definition of a "const expression" is very very limited, and hurts us exactly for the array declaration and constant initializer case. Oh well. Linus