Re: [PATCH 7/7] asm-generic: suppress sparse warning in ioctl.h

From: Linus Torvalds
Date: Wed Apr 02 2008 - 20:58:37 EST




On Wed, 2 Apr 2008, Harvey Harrison wrote:
>
> 1 ? 0 : x
>
> is not valid in contexts where C requires integer constant expressions.
> Index in static array initializer is one of those.

So I don't much like this one, because (a) we could just make sparse
accept it and (b) gcc _does_ accept it and gives us nicer error messages.

Well, maybe "nicer" is wrong (because it's a link-time one), but at least
not a _totally_ misleading one.

What does "division by zero" mean as an error message? Also, if I recall
correctly, last time we tried something like this (admittedly long ago),
some compilers would actually make it a run-time error, not a compile-time
one - it would simply refuse optimize the 1/0 into a value at all, and
just generate a run-time divide.

So I'm not even sure that all versions of gcc will even complain at all
(although it might have been icc).

Linus
--
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/