[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070627172542.GA21478@ftp.linux.org.uk>
Date: Wed, 27 Jun 2007 18:25:42 +0100
From: Al Viro <viro@....linux.org.uk>
To: Josh Triplett <josht@...ux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Neil Booth <neil@...kokuya.co.uk>,
Josh Triplett <josh@...edesktop.org>,
Segher Boessenkool <segher@...nel.crashing.org>,
linux-kernel@...r.kernel.org, linux-sparse@...r.kernel.org
Subject: Re: [PATCH 16/16] fix handling of integer constant expressions
On Wed, Jun 27, 2007 at 09:34:55AM -0700, Josh Triplett wrote:
> > is actually nice code for something like the kernel, but it turns out that
> > in order to make this work, you have to do it as
> >
> > #define htons(x) (__builtin_constant_p(x) ? constant_htons(x) : __htons(x))
That's not quite right. In principle, __builtin_choose_expr() could be
used for that kind of stuff and builtins can change the rules.
> Also agreed. Same goes for other short-circuiting operations like &&,
> ||, and ?: without the center argument; if you can determine at
> compilation time that it does not need to evaluate part of the
> expression at all, go ahead and ignore that part of the expression even
> if it does not constitute an integer constant expression. If you want
> to optionally check for this case and issue a diagnostic, put it under
> -Wstrict-constant-expressions or similar.
That actually means extra work for evaluate_expression(). Unfortunately.
The thing is, we want to typecheck all branches, even ones not taken.
_However_, we don't want to expand all of them. Having extra places
where we have to do expansion means extra work.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists