[Xcb-commit] xcb

Jamey Sharp jamey at kemper.freedesktop.org
Tue Mar 7 10:25:55 PST 2006


 xcb/acinclude.m4 |   29 +++++++++++++++++++++++++++++
 xcb/configure.ac |    2 ++
 xcb/src/xcbint.h |    9 +++++++++
 3 files changed, 40 insertions(+)

New commits:
diff-tree 06683c10caa826b7397a4d9e5c2a2c0d1ee64870 (from 9ada104ccd1e907facc254f5977f6d028095503e)
Author: TORRI Vincent <Vincent.Torri at iecn.u-nancy.fr>
Date:   Tue Mar 7 10:25:23 2006 -0800

    Use the GCC 4 visibility extension to mark everything in xcbint.h hidden.

diff --git a/xcb/acinclude.m4 b/xcb/acinclude.m4
new file mode 100644
index 0000000..46a82b9
--- /dev/null
+++ b/xcb/acinclude.m4
@@ -0,0 +1,29 @@
+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 ${CC} 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}
+   ])
diff --git a/xcb/configure.ac b/xcb/configure.ac
index 5e4405c..b022b4c 100644
--- a/xcb/configure.ac
+++ b/xcb/configure.ac
@@ -99,6 +99,8 @@ CWARNFLAGS="-Wall -pedantic -Wpointer-ar
 	-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
 AC_SUBST(CWARNFLAGS)
 
+GCC_CHECK_VISIBILITY()
+
 AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
 AC_CONFIG_FILES([xcb.pc])
 
diff --git a/xcb/src/xcbint.h b/xcb/src/xcbint.h
index f3830f9..7c8f331 100644
--- a/xcb/src/xcbint.h
+++ b/xcb/src/xcbint.h
@@ -32,6 +32,10 @@
 #include "config.h"
 #endif
 
+#ifdef GCC_HAS_VISIBILITY
+#pragma GCC visibility push(hidden)
+#endif
+
 enum workarounds {
     WORKAROUND_NONE,
     WORKAROUND_GLX_GET_FB_CONFIGS_BUG
@@ -154,4 +158,9 @@ struct XCBConnection {
 };
 
 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-commit mailing list