[PATCH v2 xserver] dmx: force -fno-strict-aliasing for xinput example

Gaetan Nadon memsize at videotron.ca
Wed Dec 7 17:17:31 PST 2011

From: Peter Hutterer <peter.hutterer at who-t.net>

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

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.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
	Version 2 uses new variables in util-macros 1.16.0

 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
 xtest_SOURCES = xtest.c

More information about the xorg-devel mailing list