[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200903260914.46958.rusty@rustcorp.com.au>
Date: Thu, 26 Mar 2009 09:14:46 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Nikanth Karthikesan <knikanth@...ell.com>
Cc: nikanth@...il.com, linux-kernel@...r.kernel.org
Subject: Re: Strange code in include/linux/cpumask.h
On Wednesday 25 March 2009 17:14:30 Nikanth Karthikesan wrote:
> On Wednesday 25 March 2009 10:41:11 Rusty Russell wrote:
> > Yes, except that this insists that bitmap be an unsigned long * or you'll
> > get a warning. Otherwise the macro could be used on anything. And it
> > needs to be a macro to use it as a static initializer.
>
> Ah, got it. Thanks a lot for the explanation. May be a comment could be added
> to the source.
Well, it's not that unusual a trick in the kernel, but an explanation might
help.
> Also looks like, this is not being used as a static initializer anywhere.
> i.e., Using my type-checking only version didn't trigger any error/warnings!
It will. cpu_all_mask uses to_cpumask, and it's replacing CPU_MASK_ALL.
> Being a deprecated interface, no new users are expected? Or is gcc smart, not
> complaining when used as static initializer, as it would always evaluate to
> (struct cpumask *)(bitmap)?
Yes, it seems to be. AFAICT though, using a function in an initializer is not
valid C.
> Can the sizeof constification be removed?
Possibly, but it makes me nervous to rely on it.
Thanks,
Rusty.
>
> Thanks
> Nikanth
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists