What makes this comparison always 0?
Richard Henderson
rth@redhat.com
Tue Nov 26 04:37:00 GMT 2002
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) : \
> KS_GROUP_Ascii)))
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. :-/
r~
More information about the Gcc
mailing list