redefinition of PointerBarrier.

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

PointerBarriers is defined in XFixes.h and here. So hook onto the only thing
we can in Xfixes.h and use that to figure out if we need to typedef
ourselves. XFIXES_MAJOR is defined in xfixeswire.h, so we can't hook onto it
directly.

Adding this ifdef here means we have include order dependency of XFixes.h
before XInput2.h unless we add a similar ifdef to the fixes headers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
Nasty, but can't think of a better way atm.
This commit is contained in:
wiz 2013-03-12 11:39:49 +00:00
parent 626153e855
commit 2d697d664e
3 changed files with 45 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.20 2013/03/07 06:36:28 wiz Exp $
# $NetBSD: Makefile,v 1.21 2013/03/12 11:39:49 wiz Exp $
#
DISTNAME= libXi-1.7
PKGREVISION= 1
CATEGORIES= x11 devel
MASTER_SITES= ${MASTER_SITE_XORG:=lib/}
EXTRACT_SUFX= .tar.bz2

View file

@ -1,5 +1,6 @@
$NetBSD: distinfo,v 1.17 2013/03/07 06:36:28 wiz Exp $
$NetBSD: distinfo,v 1.18 2013/03/12 11:39:49 wiz Exp $
SHA1 (libXi-1.7.tar.bz2) = 1c4e992094f71103660f16329b228b081f48d48c
RMD160 (libXi-1.7.tar.bz2) = 368ed28a1562dff67ebdb6e7433205e04c62c0a0
Size (libXi-1.7.tar.bz2) = 433745 bytes
SHA1 (patch-include_X11_extensions_XInput2.h) = 6e1e5dd3aa8c4b0507aca44c8b7ae51a45cf1b69

View file

@ -0,0 +1,41 @@
$NetBSD: patch-include_X11_extensions_XInput2.h,v 1.1 2013/03/12 11:39:49 wiz Exp $
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
PointerBarriers is defined in XFixes.h and here. So hook onto the only thing
we can in Xfixes.h and use that to figure out if we need to typedef
ourselves. XFIXES_MAJOR is defined in xfixeswire.h, so we can't hook onto it
directly.
Adding this ifdef here means we have include order dependency of XFixes.h
before XInput2.h unless we add a similar ifdef to the fixes headers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
Nasty, but can't think of a better way atm.
include/X11/extensions/XInput2.h | 4 ++++
1 file changed, 4 insertions(+)
--- include/X11/extensions/XInput2.h.orig 2013-02-19 01:08:17.000000000 +0000
+++ include/X11/extensions/XInput2.h
@@ -169,7 +169,11 @@ typedef struct
int status;
} XIGrabModifiers;
+/* Xfixes.h typedefs PointerBarrier and gcc pre-4.6 (or with -pedantic) will
+ complain about the duplicate typedef */
+#if !defined _XFIXES_H_ || XFIXES_MAJOR < 5
typedef XID PointerBarrier;
+#endif
typedef unsigned int BarrierEventID;
typedef struct