[lkml]   [2012]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch 3.5-rc3] mm, mempolicy: fix mbind() to do synchronous migration
On Thu, Jun 21, 2012 at 6:45 PM, Andrew Morton
<> wrote:
>> I wonder if I should make sparse warn about any casts to/from enums.
>> They tend to always be wrong.
> I think it would be worth trying, see how much fallout there is.  Also
> casts from "enum a" to "enum b".  We've had a few of those,
> unintentionally.

Ugh. We have this all over. Well, at least in multiple places.

Like <linux/personality.h>, which does things like


where PER_LINUX_32BIT is one enum, and ADDR_LIMIT_32BIT is a different one.

And things like


in <linux/workqueue.h> is similar.

Sure, my quick warning generator gives lots of extraneous warnings,
and it complains about the above kind of "mixing enum with int"
behavior, but the above is a very real example of casting an enum to
an integer. And we *want* it to happen in the above cases.

I'll see what it looks like if I only warn about casting *to* an enum.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-06-22 06:01    [W:0.044 / U:12.816 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site