xkbmisc.c: 2 * bad if test ?
Submitted by dcb..@..il.com
Assigned to Xorg Project Team
Description
I just compiled libxkbfile with extra Linux gcc flag -Wlogical-op
It said
xkbmisc.c:118:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
Source code is
((ks>=XK_Ygrave)&&(ks<=XK_Fabovedot))||
but
[dcb@zippy4 SPECS]$ fgrep XK_Ygrave `find /usr/include/X11 -name \*.h -print`
/usr/include/X11/keysymdef.h:#define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */
[dcb@zippy4 SPECS]$ fgrep XK_Fabovedot `find /usr/include/X11 -name \*.h -print`
/usr/include/X11/keysymdef.h:#define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */
[dcb@zippy4 SPECS]$
Suggest code rework.
xkbmisc.c:132:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
Source code is
((ks>=XK_wdiaeresis)&&(ks<=XK_ycircumflex))) {
but
[dcb@zippy4 SPECS]$ fgrep XK_wdiaeresis `find /usr/include/X11 -name \*.h -print`
/usr/include/X11/keysymdef.h:#define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */
[dcb@zippy4 SPECS]$ fgrep XK_ycircumflex `find /usr/include/X11 -name \*.h -print`
/usr/include/X11/keysymdef.h:#define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */
[dcb@zippy4 SPECS]$
Also suggest code rework.
You may wish to consider adding gcc compiler flag -Wlogical-op to your development builds of libxkbmisc. I checked the current source code and these two bugs seem to still exist.