2007-01-26 Matthias Clasen <mclasen@redhat.com>
+ * 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 <mclasen@redhat.com>
+
* gmem.c:
* gslice.c:
* gmessages.c:
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
#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
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)
+2007-01-26 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/tmpl/macros_misc.sgml: Document G_GNUC_INTERNAL
+ support for Sun Studio.
+
2007-01-23 Matthias Clasen <mclasen@redhat.com>
* gobject/tmpl/objects.sgml: Document
<!-- ##### MACRO G_GNUC_INTERNAL ##### -->
<para>
-Expands to the GNU C <literal>visibility(hidden)</literal> attribute if the
-compiler supports it (currently only <command>gcc</command>). 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.
+</para>
+<para>
+When using a compiler that supports the GNU C hidden visibility attribute,
+this macro expands to <literal>__attribute__((visibility("hidden")))</literal>.
+When using the Sun Studio compiler, it expands to <literal>__hidden</literal>.
</para>
+<para>
+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.
+</para>
+<informalexample><programlisting>
+G_GNUC_INTERNAL
+void _g_log_fallback_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data);
+</programlisting></informalexample>
Since: 2.6
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:
/* 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 ();