From: Matthias Clasen Date: Sat, 27 Jan 2007 03:34:48 +0000 (+0000) Subject: Define G_GNUC_INTERNAL for Sun Studio as __hidden. (#342981, Brian X-Git-Tag: GLIB_2_13_0~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df3dd538e555ca1caeba4f507aea707916895a98;p=platform%2Fupstream%2Fglib.git Define G_GNUC_INTERNAL for Sun Studio as __hidden. (#342981, Brian 2007-01-26 Matthias Clasen * configure.in: Define G_GNUC_INTERNAL for Sun Studio as __hidden. (#342981, Brian Cameron) * glib/gconvert.c: * glib/gutf8.c: Move G_GNUC_INTERNAL uses to the right spot. 2 svn path=/trunk/; revision=5317 --- diff --git a/ChangeLog b/ChangeLog index aaf6776..4daccd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2007-01-26 Matthias Clasen + * configure.in: Define G_GNUC_INTERNAL for Sun Studio + as __hidden. (#342981, Brian Cameron) + + * glib/gconvert.c: + * glib/gutf8.c: Move G_GNUC_INTERNAL uses to the right + spot. + +2007-01-26 Matthias Clasen + * gmem.c: * gslice.c: * gmessages.c: diff --git a/configure.in b/configure.in index dd35c94..4b478de 100644 --- a/configure.in +++ b/configure.in @@ -786,6 +786,15 @@ int main (int argc, char **argv) AC_MSG_RESULT($g_have_gnuc_visibility) AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes]) +AC_MSG_CHECKING([whether using Sun Studio C compiler]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550) +#else +# include "error: this is not Sun Studio." +#endif +]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ]) +AC_MSG_RESULT($g_have_sunstudio_visibility) +AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility = xyes]) + # check for bytesex stuff AC_C_BIGENDIAN @@ -2440,10 +2449,16 @@ _______EOF #define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) #endif _______EOF - else + else + if test x$g_have_sunstudio_visibility = xyes ; then + cat >>$outfile <<_______EOF +#define G_GNUC_INTERNAL __hidden +_______EOF + else cat >>$outfile <<_______EOF #define G_GNUC_INTERNAL _______EOF + fi fi @@ -2769,6 +2784,7 @@ g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs g_can_inline=$g_can_inline g_have_gnuc_visibility=$g_have_gnuc_visibility +g_have_sunstudio_visibility=$g_have_sunstudio_visibility case xyes in x$ac_cv_c_bigendian) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index d39d4dd..17ff604 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2007-01-26 Matthias Clasen + + * glib/tmpl/macros_misc.sgml: Document G_GNUC_INTERNAL + support for Sun Studio. + 2007-01-23 Matthias Clasen * gobject/tmpl/objects.sgml: Document diff --git a/docs/reference/glib/tmpl/macros_misc.sgml b/docs/reference/glib/tmpl/macros_misc.sgml index 580aebc..e2b954f 100644 --- a/docs/reference/glib/tmpl/macros_misc.sgml +++ b/docs/reference/glib/tmpl/macros_misc.sgml @@ -309,12 +309,29 @@ Since: 2.6 -Expands to the GNU C visibility(hidden) attribute if the -compiler supports it (currently only gcc). This attribute -can be used for marking library functions as being used internally to the lib -only, to not create inefficient PLT entries. Note that static functions do not -need to be marked as internal in this way. See the GNU C documentation for details. +This attribute can be used for marking library functions as being used +internally to the library only, which may allow the compiler to handle +function calls more efficiently. +Note that static functions do not need to be marked as internal in this way. +See the GNU C documentation for details. + + +When using a compiler that supports the GNU C hidden visibility attribute, +this macro expands to __attribute__((visibility("hidden"))). +When using the Sun Studio compiler, it expands to __hidden. + +Note that for portability, the attribute should be placed before the +function declaration. While GCC allows the macro after the declaration, +Sun Studio does not. + + +G_GNUC_INTERNAL +void _g_log_fallback_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data); + Since: 2.6 diff --git a/glib/gconvert.c b/glib/gconvert.c index 4c25674..ab0b18e 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -89,7 +89,8 @@ try_to_aliases (const char **to_aliases, return FALSE; } -extern const char ** G_GNUC_INTERNAL _g_charset_get_aliases (const char *canonical_name); +G_GNUC_INTERNAL extern const char ** +_g_charset_get_aliases (const char *canonical_name); /** * g_iconv_open: diff --git a/glib/gutf8.c b/glib/gutf8.c index 6d98502..87dad3f 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -435,7 +435,7 @@ get_alias_hash (void) /* As an abuse of the alias table, the following routines gets * the charsets that are aliases for the canonical name. */ -const char ** G_GNUC_INTERNAL +G_GNUC_INTERNAL const char ** _g_charset_get_aliases (const char *canonical_name) { GHashTable *alias_hash = get_alias_hash ();