Messages in this thread | | | Date | Wed, 2 Apr 2008 17:57:54 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH 7/7] asm-generic: suppress sparse warning in ioctl.h |
| |
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
| |