Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add __BEGIN_PUBLIC / __END_PUBLIC, __BEGIN_HIDDEN / ...



details:   https://anonhg.NetBSD.org/src/rev/20a75ac0e76d
branches:  trunk
changeset: 756924:20a75ac0e76d
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Aug 07 21:03:18 2010 +0000

description:
Add __BEGIN_PUBLIC / __END_PUBLIC, __BEGIN_HIDDEN / __END_HIDDEN and
__dso_public and __dso_hidden markers. Change __BEGIN_DECLS /
__END_DECLS to include __BEGIN_PUBLIC / __END_PUBLIC.

diffstat:

 sys/sys/cdefs.h |  39 ++++++++++++++++++++++++++++-----------
 1 files changed, 28 insertions(+), 11 deletions(-)

diffs (60 lines):

diff -r 43599cc67b46 -r 20a75ac0e76d sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Sat Aug 07 20:47:27 2010 +0000
+++ b/sys/sys/cdefs.h   Sat Aug 07 21:03:18 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.79 2010/07/31 00:04:43 joerg Exp $ */
+/*     $NetBSD: cdefs.h,v 1.80 2010/08/07 21:03:18 joerg Exp $ */
 
 /*
  * Copyright (c) 1991, 1993
@@ -63,16 +63,6 @@
 #include <sys/cdefs_aout.h>
 #endif
 
-#if defined(__cplusplus)
-#define        __BEGIN_DECLS           extern "C" {
-#define        __END_DECLS             }
-#define        __static_cast(x,y)      static_cast<x>(y)
-#else
-#define        __BEGIN_DECLS
-#define        __END_DECLS
-#define        __static_cast(x,y)      (x)y
-#endif
-
 /*
  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
@@ -228,6 +218,33 @@
 #define        __used          __unused
 #endif
 
+#if __GNUC_PREREQ__(4, 0)
+#  define __dso_public __attribute__((__visibility__("default")))
+#  define __dso_hidden __attribute__((__visibility__("hidden")))
+#  define __BEGIN_PUBLIC       _Pragma("GCC visibility push(default)")
+#  define __END_PUBLIC         _Pragma("GCC visibility pop")
+#  define __BEGIN_HIDDEN       _Pragma("GCC visibility push(hidden)")
+#  define __END_HIDDEN         _Pragma("GCC visibility pop")
+#else
+#  define __dso_public
+#  define __dso_hidden
+#  define __BEGIN_PUBLIC
+#  define __END_PUBLIC
+#  define __BEGIN_HIDDEN
+#  define __END_HIDDEN
+#endif
+
+
+#if defined(__cplusplus)
+#define        __BEGIN_DECLS           __BEGIN_PUBLIC extern "C" {
+#define        __END_DECLS             } __END_PUBLIC
+#define        __static_cast(x,y)      static_cast<x>(y)
+#else
+#define        __BEGIN_DECLS           __BEGIN_PUBLIC
+#define        __END_DECLS             __END_PUBLIC
+#define        __static_cast(x,y)      (x)y
+#endif
+
 /*
  * Non-static C99 inline functions are optional bodies.  They don't
  * create global symbols if not used, but can be replaced if desirable.



Home | Main Index | Thread Index | Old Index