-Wlogical-op warning on DeliverEmulatedMotionEvent

Alan Coopersmith alan.coopersmith at oracle.com
Sat Oct 26 23:23:05 CEST 2013

gcc -Wlogical-op on Xorg git master says:

exevents.c: In function 'DeliverEmulatedMotionEvent':
exevents.c:1480:13: warning: logical 'or' of collectively exhaustive tests is 
always true [-Wlogical-op]

The relevant snippet of exevents.c:

    1479         if (ti->listeners[0].type != LISTENER_POINTER_REGULAR ||
    1480             ti->listeners[0].type != LISTENER_POINTER_GRAB)
    1481             return;

The warning seems to be correct, as they are two different values in an enum,
all values are not equal to at least one of the two, so the return is always
followed and the following 20 lines in that block become dead code.

I'd guess the || should be &&, but figured you'd be in a better position to
evaluate & test that.

	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc

More information about the xorg-devel mailing list