From: Peter Hutterer <[email protected]>

Compiler warning:
xinput.c:272: warning: dereferencing pointer 'e' does break strict-aliasing
rules

The code itself is the usual XInput client-side code:
        XEvent event;
        XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
        XNextEvent(display, &event);
        printf("%d\n", e->type);

Since XDeviceMotionEvent is not guaranteed the same size as XEvent, clients
must use pointer aliasing as above when using the XNextEvent API. Disable
strict aliasing for this example.

Reviewed-by: Peter Hutterer <[email protected]>
Reviewed-by: Gaetan Nadon <[email protected]>
Signed-off-by: Peter Hutterer <[email protected]>
Signed-off-by: Gaetan Nadon <[email protected]>
---
 hw/dmx/examples/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/dmx/examples/Makefile.am b/hw/dmx/examples/Makefile.am
index 003c143..d594b85 100644
--- a/hw/dmx/examples/Makefile.am
+++ b/hw/dmx/examples/Makefile.am
@@ -43,7 +43,7 @@ dmxrminput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(BASE_CFLAGS)
 
 xinput_SOURCES = xinput.c
 xinput_LDADD = $(DMXXIEXAMPLES_DEP_LIBS)
-xinput_CFLAGS = $(DMXXIEXAMPLES_DEP_CFLAGS) $(BASE_CFLAGS)
+xinput_CFLAGS = $(DMXXIEXAMPLES_DEP_CFLAGS) $(BASE_CFLAGS) 
$(NO_STRICT_ALIASING_CFLAG)
 
 xtest_SOURCES = xtest.c
 xtest_LDADD = $(XTSTEXAMPLES_DEP_LIBS)
-- 
1.7.4.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to