This is the mail archive of the
mailing list for the GCC project.
Re: What makes this comparison always 0?
- From: Richard Henderson <rth at redhat dot com>
- To: Jason R Thorpe <thorpej at wasabisystems dot com>, gcc at gcc dot gnu dot org
- Date: Mon, 25 Nov 2002 18:39:44 -0800
- Subject: Re: What makes this comparison always 0?
- References: <20021125170225.GA19290@yeah-baby.shagadelic.org>
On Mon, Nov 25, 2002 at 09:02:25AM -0800, Jason R Thorpe wrote:
> #define KS_GROUP_Dead 0xf801 /* not encoded in keysym */
> #define KS_GROUP_Ascii 0xf802 /* not encoded in keysym */
> #define KS_GROUP_Keycode 0xf803 /* not encoded in keysym */
> #define KS_GROUP(k) ((k) >= 0x0300 && (k) < 0x0370 ? KS_GROUP_Dead : \
> (((k) & 0xf000) == 0xe000 ? KS_GROUP_Keycode : \
> (((k) & 0xf800) == 0xf000 ? ((k) & 0xff00) : \
The warning comes when GCC pushes the outer comparison into the ?:
so we wind up with, in part,
((k) & 0xff00) == 0xf803
which is indeed always false.
We should have a better way to distinguish trees that came from
user source code and those that didn't. The later shouldn't be
warned about. This is not easy to fix, I think. :-/