lkml.org 
[lkml]   [2008]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2008-04-03 03:01    [W:1.994 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site