I apologize for sending a separate cover letter for a single patch. Andi Kleen wrote: > On Wed, Aug 15, 2007 at 05:02:47PM -0400, Chuck Lever wrote: >> The return type of __scanbit() doesn't match the return type of >> find_{first,next}_bit(). Thus when you construct something like >> this: >> >> boolean ? __scanbit() : find_first_bit() > > Why would you want to write this? What is boolean? > Do they have different arguments? So here's the definition of the x86_64 find_first_bit() macro, straight from include/x86_64/bitops.h: #define find_first_bit(addr,size) \ ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ (__scanbit(*(unsigned long *)addr,(size))) : \ find_first_bit(addr,size))) In this case "boolean" is: __builtin_constant_p(size) && (size) <= BITS_PER_LONG the first arm of the conditional is: __scanbit(*(unsigned long *)addr,(size)) the second arm of the conditional is: find_first_bit(addr,size) (this is the "function" version of find_first_bit, not the macro that's being defined. The naming here is unfortunately confusing). Thus, roughly speaking, when the type of "size" is smaller than a long, the macro's return type evaluates to unsigned long. If "size" is larger than a long, the macro's return type evaluates to signed long. By making the return type of __scanbit() an unsigned long, both arms of the conditional evaluate to the same result type. > It's on my todo list for some time to special case > f_f_b() and friends for smaller arguments. Would > that eliminate this construct? Well, I can only assume what you mean by this, but I think that would address the problem. My real interest here is to eliminate a whole lot of compiler noise when I enable -Wsign-compare for certain parts of the kernel.