[Xcb] Status of XCB and howto begin

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Sat Feb 11 03:37:59 PST 2006


Hello,

ok, here it is. I've attached the (diff ;) ) files. Some comments :

1) in xcbint.h, i've removed some trailing spaces.
2) I have included config.h because AC_CONFIG_HEADERS does not allow to
pass -Dvariable to gcc and put the variable in config.h
3) i've incremented the year in xcbint.h

And a question:
what is the meaning of -include config.h in src/Makefile.am ? I've not
find any information about it in the automake manual.

Any comments ?

Vincent

On Thu, 9 Feb 2006, Jamey Sharp wrote:

> On Wed, Feb 08, 2006 at 09:34:10PM +0100, Vincent Torri wrote:
> > Here are 2 patch for xcbint.h
> >
> > the one with the __attribute__, the other with the pragma
>
> Awesome! Thanks, Vincent!
>
> Could you regenerate these as patches (diffs) instead of whole files?
> They're easier to review that way.
>
> If I promise never to take the address of any of the functions in
> xcbint.h, you can get even better improvements, right? (That's internal
> visibility I think?) Well, I promise. Would you make the appropriate
> change?
>
> Both versions should guard the visibility-specific definitions by
> testing that a suitable version of GCC is in use. The pragmas can almost
> do without that except I think GCC 3 will give a warning on them, which
> is lame.
>
> > #pragma GCC visibility push(hidden)
> > ...
> > #pragma GCC visibility pop
>
> > #define XCBLOCAL  __attribute__ ((visibility("hidden")))
>
> I'm still happiest with the pragma, I think. I guess I'd say you should
> commit that one, unless other people have strong arguments against.
>
> --Jamey
>
-------------- next part --------------
--- configure.ac.~1.14.~	2005-12-28 20:34:52.000000000 +0100
+++ configure.ac	2006-02-11 12:48:30.511085524 +0100
@@ -78,6 +78,8 @@
 	-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
 AC_SUBST(CDEBUGFLAGS)
 
+GCC_CHECK_VISIBILITY()
+
 AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
 AC_CONFIG_FILES([xcb.pc])
 
-------------- next part --------------
dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2006-02-11
dnl
dnl GCC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Check the visibility feature of gcc
dnl
AC_DEFUN([GCC_CHECK_VISIBILITY],
   [AC_MSG_CHECKING([whether ${CXX} supports visibility feature])
    save_CFLAGS=${CFLAGS}
    CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
    AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[
#pragma GCC visibility push(hidden)
extern void f(int);
#pragma GCC visibility pop
          ]],
          [[]]
        )],
       [AC_DEFINE(
           GCC_HAS_VISIBILITY,
           [],
           [Defined if GCC supports the vilibility feature])
        m4_if([$1], [], [:], [$1])
        AC_MSG_RESULT(yes)],
       [m4_if([$2], [], [:], [$2])
        AC_MSG_RESULT(no)])
    CFLAGS=${save_CFLAGS}
   ])
-------------- next part --------------
--- xcbint.h.~1.23.~	2005-12-24 11:30:15.000000000 +0100
+++ xcbint.h	2006-02-11 12:34:12.034226519 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
+ * Copyright (C) 2001-2006 Bart Massey and Jamey Sharp.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -8,17 +8,17 @@
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  * Except as contained in this notice, the names of the authors or their
  * institutions shall not be used in advertising or otherwise to promote the
  * sale, use or other dealings in this Software without prior written
@@ -28,6 +28,12 @@
 #ifndef __XCBINT_H
 #define __XCBINT_H
 
+#include "config.h"
+
+#ifdef GCC_HAS_VISIBILITY
+#pragma GCC visibility push(hidden)
+#endif
+
 /* Not simply (a <= b) because eventually the 32-bit sequence number
  * will wrap, causing earlier sequence numbers to be higher than later
  * ones for a brief but fatal period. (a and b must be unsigned.) */
@@ -180,4 +186,9 @@
 };
 
 int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *cond);
+
+#ifdef GCC_HAS_VISIBILITY
+#pragma GCC visibility pop
+#endif
+
 #endif


More information about the Xcb mailing list