[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120322160944.ad06e559.akpm@linux-foundation.org>
Date: Thu, 22 Mar 2012 16:09:44 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Konstantin Khlebnikov <khlebnikov@...nvz.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Minchan Kim <minchan@...nel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Hugh Dickins <hughd@...gle.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Ben Herrenschmidt <benh@...nel.crashing.org>,
"linux@....linux.org.uk" <linux@....linux.org.uk>,
Christopher Li <sparse@...isli.org>
Subject: Re: [PATCH 00/16] mm: prepare for converting vm->vm_flags to 64-bit
On Fri, 23 Mar 2012 02:52:05 +0400
Konstantin Khlebnikov <khlebnikov@...nvz.org> wrote:
> >> Is this ok?
> >
> > Yes.
> >
> > The thing about __nocast is that it's so *very* very easy to lose it.
> > For example, do this:
> >
> > typedef long __nocast long_t;
> >
> > int main(long_t a)
> > {
> > return a;
> > }
> >
> > and you get the (expected) warning.
> >
> > HOWEVER. Now do "return a+1" instead, and the warning goes away. Why?
> > Because the expression ends up having just the type "long", because
> > the "a" mixed happily with the "1" (that was cast from 'int' to 'long'
> > by the normal C type rules).
> >
> > That is arguably a bug, but this kind of thing really wasn't what
> > __nocast was designed for. The __nocast design ended up being too
> > weak, though, and we hardly use it in the kernel.
> >
>
> Thanks. Looks like "__nocast" totally undocumented.
> It would be nice to add something about this into Documentation/sparse.txt
Yup, Chris has added this to his todo list (thanks!).
--
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