Re: [PATCH] fs/fcntl.c - remove impossible <0 check in do_fcntl - arg is unsigned.

From: Matthew Wilcox
Date: Thu Jan 08 2004 - 07:15:00 EST


On Wed, Jan 07, 2004 at 06:47:49PM -0800, Linus Torvalds wrote:
>
>
> On Thu, 8 Jan 2004, Jesper Juhl wrote:
> >
> > The 'arg' argument to the function do_fcntl in fs/fcntl.c is of type
> > 'unsigned long', thus it can never be less than zero (all callers of
> > do_fcntl take unsigned arguments as well and pass on unsigned values),
>
> I'm not sure I like these kinds of patches.
>
> I _like_ the code being readable. The fact that the compiler can optimize
> away one of the tests if the type is right is fine. It seems to be
> draconian to remove code that is correct and safe, especially when the
> code has no real downsides to it.
>
> Do we have a compiler that needlessly complains again?

gcc does indeed complain about it with -W. But -W turns on so many other
warnings, this one's lost in the noise. I would actually like to be
able to make the header files -W clean so that I can compile individual
files with -W to catch some of my worst mistakes.

But I don't think that making the entire build -W clean is worthwhile.
It'd make the code too ugly.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/