mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/7] asm-generic: suppress sparse warning in ioctl.h
Date: Wed, 2 Apr 2008 17:57:54 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.00.0804021752040.14670@woody.linux-foundation.org> (raw)
In-Reply-To: <1207182818.5740.26.camel@brick>



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

  reply	other threads:[~2008-04-03  0:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03  0:33 Harvey Harrison
2008-04-03  0:57 ` Linus Torvalds [this message]
2008-04-03  1:34   ` Al Viro
2008-04-03  1:50     ` Linus Torvalds
2008-04-03  1:59       ` Al Viro
2008-04-03  2:51         ` Linus Torvalds
2008-04-03  2:55           ` Al Viro
2008-04-04  9:19             ` Al Viro
2008-04-03  2:41       ` Al Viro
2008-04-03 20:31         ` Josh Triplett
2008-04-04  1:19           ` Al Viro
2008-04-04  2:00             ` Al Viro
2008-04-04 14:08             ` Derek M Jones
2008-04-04 18:42               ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.1.00.0804021752040.14670@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®