[PATCH v2 libXi] Require XFixes for PointerBarrier, remove duplicate typedef

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 27 16:24:57 PDT 2013


The PointerBarrier typedef is duplicate if a client includes both Xfixes.h
and XInput2.h.

gcc 4.6 won't complain about that, but earlier versions do:
http://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ce3765bf44e49ef0568a1ad4a0b7f807591d6412

gcc 4.6 with -pedantic-errors shows:
/opt/xorg/include/X11/extensions/XInput2.h:172:13: error: redefinition of
typedef ‘PointerBarrier’ [-pedantic]
In file included from test.c:1:0:
/opt/xorg/include/X11/extensions/Xfixes.h:255:13: note: previous declaration
of ‘PointerBarrier’ was here

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- require XFixes and remove the typedef instead of trying the #ifdef dance

 configure.ac                     | 2 ++
 include/X11/extensions/XInput2.h | 2 +-
 src/Makefile.am                  | 1 +
 xi.pc.in                         | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ab8a63c..c2897d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,8 @@ XORG_CHECK_MALLOC_ZERO
 
 # Obtain compiler/linker options for dependencies
 PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.2.99.1])
+# CFLAGS only for PointerBarrier typedef
+PKG_CHECK_MODULES(XFIXES, [xfixes >= 5])
 
 # Check for xmlto and asciidoc for man page conversion
 # (only needed by people building tarballs)
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h
index a746012..33670eb 100644
--- a/include/X11/extensions/XInput2.h
+++ b/include/X11/extensions/XInput2.h
@@ -30,6 +30,7 @@
 #include <X11/Xlib.h>
 #include <X11/extensions/XI2.h>
 #include <X11/extensions/Xge.h>
+#include <X11/extensions/Xfixes.h> /* PointerBarrier */
 
 /*******************************************************************
  *
@@ -169,7 +170,6 @@ typedef struct
     int                 status;
 } XIGrabModifiers;
 
-typedef XID PointerBarrier;
 typedef unsigned int BarrierEventID;
 
 typedef struct
diff --git a/src/Makefile.am b/src/Makefile.am
index ee40753..fbbca45 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -70,6 +70,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
               -I$(top_srcdir)/include/X11/extensions
 
 AM_CFLAGS = $(XI_CFLAGS) \
+            $(XFIXES_CFLAGS) \
             $(MALLOC_ZERO_CFLAGS) \
             $(CWARNFLAGS)
 
diff --git a/xi.pc.in b/xi.pc.in
index 3f05dd8..d97db20 100644
--- a/xi.pc.in
+++ b/xi.pc.in
@@ -7,6 +7,6 @@ Name: Xi
 Description: X Input Extension Library
 Version: @VERSION@
 Requires: inputproto
-Requires.private: x11 xext
+Requires.private: x11 xext xfixes
 Cflags: -I${includedir}
 Libs: -L${libdir} -lXi
-- 
1.8.1.4



More information about the xorg-devel mailing list